[Bug middle-end/87798] EH lowering is creating a gimple_switch statement with type-incompatible index and case labels
aldyh at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Aug 27 19:02:24 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87798
Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aldyh at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed|2018-10-30 00:00:00 |2020-08-27
--- Comment #1 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
This seems to be the same problem we're seeing in PR96818, which interestingly
is C++, so this affects more than just Ada:
bool operatorY ();
struct l
{
int m;
int k;
void n ();
l ()
{
while (operatorY ())
switch ((unsigned char) k)
case 0:
{
n ();
case 1:if (m)
;
}
}
};
void
p ()
{
l ();
}
In simplify_stmt_for_jump_threading we see:
(gdb) p debug(switch_stmt)
switch (_6) <default: <L7> [33.33%], case 0: <L3> [33.33%], case 1: <L6>
[33.33%]>
;; Type of switch operand _6 is "int":
(gdb) p debug_generic_stmt(switch_stmt->op[0].typed.type)
int
;; gimple_switch_label(switch_stmt, 1):
(gdb) p debug_generic_stmt(switch_stmt->op[2])
case 0:;
;; Type of CASE_LOW of case 0 is unsigned char:
(gdb) p debug_generic_stmt(switch_stmt->op[2].exp.operands[0].typed.type)
unsigned char
I won't go into the details of the other PR, but suffice to say that it's
caused by switch operands being a different type than the case low/high values.
More information about the Gcc-bugs
mailing list