Repository: flutter
Issue: [Impeller] Compiler: GLSL array literals in shaders crash at runtime.
Labels: c: crash,engine,has reproducible steps,P2,e: impeller,found in release: 3.7,found in release: 3.10,team-engine,triaged-engine

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. Use a GLSL array literal in a shader and load it with `FragmentProgram.fromAsset` (see the code sample for detail)

### Expected results

Shader compiling successfully and working correctly OR a diagnostic at `flutter run` and/or `flutter build` 

### Actual results


```console
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: Invalid SkSL:
// This SkSL shader is autogenerated by spirv-cross.

float4 flutter_FragCoord;

const vec2 _22[4] = vec2[](vec2(0.375, 0.125), vec2(0.875, 0.375), vec2(0.125, 0.625), vec2(0.625, 0.875));

vec4 outColor;

void FLT_main()
{
    outColor = vec4(1.0);
}

half4 main(float2 iFragCoord)
{
      flutter_FragCoord = float4(iFragCoord, 0, 0);
      FLT_main();
      return outColor;
}
|
SkSL Error:
error: 5: missing index in '[]'
const vec2 _22[4] = vec2[](vec2(0.375, 0.125), vec2(0.875, 0.375), vec2(0.125, 0.625), vec2(0.625, 0.875));
                        ^^
1 error

#0      new FragmentProgram._fromAsset (dart:ui/painting.dart:4328:7)
#1      FragmentProgram.fromAsset.<anonymous closure> (dart:ui/painting.dart:4355:55)
#2      new Future.microtask.<anonymous closure> (dart:async/future.dart:280:37)
#3      _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#4      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
```

### Code sample

<details><summary>Code sample</summary>

```dart
import 'dart:ui';

void main() async {
  await FragmentProgram.fromAsset('shaders/crasher.frag');
}
```

Drop the following into `shaders/crasher.frag`. Remember to add this shader to your list of shaders in `pubspec.yaml`.
```glsl
vec2 sampleLocations[4] = {
  vec2(0.375, 0.125),
  vec2(0.875, 0.375),
  vec2(0.125, 0.625),
  vec2(0.625, 0.875),
};

out vec4 outColor;

void main() {
  outColor = vec4(1.0);
}
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details><summary>Logs</summary>

```console
$ flutter --version
Flutter 3.10.0-15.0.pre.13 • channel master • https://github.com/flutter/flutter.git
Framework • revision b03d6d65b8 (18 hours ago) • 2023-04-26 15:02:09 -0400
Engine • revision f2882afe0e
Tools • Dart 3.1.0 (build 3.1.0-47.0.dev) • DevTools 2.23.1
```

```console
$ flutter run
Launching lib/main.dart on Linux in debug mode...
Building Linux application...                                           
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: Invalid SkSL:
// This SkSL shader is autogenerated by spirv-cross.

float4 flutter_FragCoord;

const vec2 _22[4] = vec2[](vec2(0.375, 0.125), vec2(0.875, 0.375), vec2(0.125, 0.625), vec2(0.625, 0.875));

vec4 outColor;

void FLT_main()
{
    outColor = vec4(1.0);
}

half4 main(float2 iFragCoord)
{
      flutter_FragCoord = float4(iFragCoord, 0, 0);
      FLT_main();
      return outColor;
}
|
SkSL Error:
error: 5: missing index in '[]'
const vec2 _22[4] = vec2[](vec2(0.375, 0.125), vec2(0.875, 0.375), vec2(0.125, 0.625), vec2(0.625, 0.875));
                        ^^
1 error

#0      new FragmentProgram._fromAsset (dart:ui/painting.dart:4328:7)
#1      FragmentProgram.fromAsset.<anonymous closure> (dart:ui/painting.dart:4355:55)
#2      new Future.microtask.<anonymous closure> (dart:async/future.dart:280:37)
#3      _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#4      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
$ flutter doctor -v
[✓] Flutter (Channel master, 3.10.0-15.0.pre.13, on Ubuntu 22.04.2 LTS 5.19.0-40-generic, locale en_US.UTF-8)
    • Flutter version 3.10.0-15.0.pre.13 on channel master at /home/nanokatze/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b03d6d65b8 (18 hours ago), 2023-04-26 15:02:09 -0400
    • Engine revision f2882afe0e
    • Dart version 3.1.0 (build 3.1.0-47.0.dev)
    • DevTools version 2.23.1

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /usr/lib/android-sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.2 LTS 5.19.0-40-generic

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 3 categories.
```

</details>