Shader compiler bug?

I’ve created this surface shader

Shader "Mobile/VertexLit"
{
Properties
{
    _MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
    Tags {"Queue"="Transparent-1" "IgnoreProjector"="True" "RenderType"="Transparent" "ForceNoShadowCasting"="True"}
    LOD 150
    Blend SrcAlpha OneMinusSrcAlpha

CGPROGRAM
#pragma surface surf Simple noforwardadd novertexlights noambient noshadow nolightmap nofog nometa exclude_path:deferred exclude_path:prepass alpha:blend

sampler2D _MainTex;

struct Input
{
    half2 uv_MainTex;
    fixed4 colour : Color;
};

half4 LightingSimple (SurfaceOutput s, half3 lightDir, half atten)
{
  half4 c;

  c.rgb = s.Albedo * (unity_AmbientSky.rgb + _LightColor0.rgb);
  c.a = s.Alpha;

  return c;
}

void surf (Input IN, inout SurfaceOutput o)
{
    fixed4 c = tex2D(_MainTex, IN.uv_MainTex);

    float cAlpha = c.a;

    c.rgb = c.rgb * IN.colour.rgb;

    o.Albedo = c.rgb;
    o.Alpha = cAlpha;
}
ENDCG
}

}

Its producing this as a vertex shader in gles2 code.

#ifdef VERTEX
attribute vec4 _glesVertex;
attribute vec4 _glesColor;
attribute vec3 _glesNormal;
attribute vec4 _glesMultiTexCoord0;
uniform highp mat4 glstate_matrix_mvp;
uniform highp mat4 unity_WorldToObject;
uniform highp vec4 _MainTex_ST;
varying mediump vec2 xlv_TEXCOORD0;
varying mediump vec3 xlv_TEXCOORD1;
varying lowp vec4 xlv_COLOR0;
void main ()
{
  lowp vec3 worldNormal_1;
  mediump vec2 tmpvar_2;
  mediump vec3 tmpvar_3;
  highp vec4 tmpvar_4;
  tmpvar_4.w = 1.0;
  tmpvar_4.xyz = _glesVertex.xyz;
  tmpvar_2 = ((_glesMultiTexCoord0.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
  highp mat3 tmpvar_5;
  tmpvar_5[0] = unity_WorldToObject[0].xyz;
  tmpvar_5[1] = unity_WorldToObject[1].xyz;
  tmpvar_5[2] = unity_WorldToObject[2].xyz;
  highp vec3 tmpvar_6;
  tmpvar_6 = normalize((_glesNormal * tmpvar_5));
  worldNormal_1 = tmpvar_6;
  tmpvar_3 = worldNormal_1;
  gl_Position = (glstate_matrix_mvp * tmpvar_4);
  xlv_TEXCOORD0 = tmpvar_2;
  xlv_TEXCOORD1 = tmpvar_3;
  xlv_COLOR0 = _glesColor;
}


#endif

As you can see its creating a varying of the world normals in tex coord 1 and I have no idea why it would do that or how to stop it! Obviously this is a massive waste of cycles.

I’m using 5.5.0f3 but its also happening on 5.6 b6

Is there something extra I can put in the shader to prevent it?

If I add ‘float3 worldNormal’ into the Input struct it makes no difference to the disassembly. If I try setting the normals in the surf method there are many more instructions added to the vertex shader, seems to start calculating tangents too.

My fragment shader doesn’t refer to tex coord 1 either so it seems wrong that it creates the varying anyway.

My only solution seems to be to make a vertex/fragment shader instead of a surface shader but then I lose the ability to trivially add instancing, shadowing, GI etc

Am I doing something really stupid and wrong?

Since no one told me I was doing something stupid I’ve reported this as a bug.

I’ve also seen the calculating un-necessary varying’s in other surface shaders I have written so it isn’t just this one specific case.

If you are interesting in following progress here is the bug link
https://fogbugz.unity3d.com/default.asp?878313_nq61acgr5s13bksp