https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98084
Bug ID: 98084 Summary: [11 Regression] ICE in error: non-integral type switch statement Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org Target Milestone: --- It's since if-to-switch revision, reduced from systemd: $ cat ~/Programming/testcases/json.i enum { JSON_VARIANT_STRING, JSON_VARIANT_UNSIGNED, JSON_VARIANT_REAL, JSON_VARIANT_ARRAY, _JSON_VARIANT_TYPE_INVALID, _JSON_VARIANT_MAGIC_ZERO_UNSIGNED, _JSON_VARIANT_MAGIC_ZERO_REAL, _JSON_VARIANT_MAGIC_EMPTY_STRING, _JSON_VARIANT_MAGIC_EMPTY_ARRAY } json_variant_type(int *v) { if (!v) return _JSON_VARIANT_TYPE_INVALID; if (v == (int *)_JSON_VARIANT_MAGIC_ZERO_UNSIGNED) return JSON_VARIANT_UNSIGNED; if (v == (int *)_JSON_VARIANT_MAGIC_ZERO_REAL) return JSON_VARIANT_REAL; if (v == (int *)_JSON_VARIANT_MAGIC_EMPTY_STRING) return JSON_VARIANT_STRING; if (v == (int *)_JSON_VARIANT_MAGIC_EMPTY_ARRAY) return JSON_VARIANT_ARRAY; } $ ./xgcc -B. ~/Programming/testcases/json.i -c -O2 /home/marxin/Programming/testcases/json.i: In function ‘json_variant_type’: /home/marxin/Programming/testcases/json.i:22:1: error: non-integral type switch statement 22 | } | ^ int * switch (v_2(D)) <default: <L16> [INV], case 0B: <L11> [INV], case 5B: <L12> [INV], case 6B: <L13> [INV], case 7B: <L14> [INV], case 8B: <L15> [INV]> during GIMPLE pass: iftoswitch /home/marxin/Programming/testcases/json.i:22:1: internal compiler error: verify_gimple failed 0xe365da verify_gimple_in_cfg(function*, bool) /home/marxin/Programming/gcc/gcc/tree-cfg.c:5467 0xd1075f execute_function_todo /home/marxin/Programming/gcc/gcc/passes.c:2042 0xd115ac do_per_function /home/marxin/Programming/gcc/gcc/passes.c:1687 0xd115ac execute_todo /home/marxin/Programming/gcc/gcc/passes.c:2096 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.