http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60435
Bug ID: 60435
Summary: GCC failes to apply CSE for va_arg with different
types whose representations match
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: bugdal at aerifal dot cx
Consider code of the following form:
long foo;
switch (cmd) {
case CMD1:
case CMD2:
case CMD3:
/* ... */
case CMD99:
foo = va_arg(ap, int);
break;
default:
foo = va_arg(ap, long);
break;
}
On machines where int and long have the same representation (even if just in
calling convention, not in memory), this whole switch should be eliminated. GCC
fails to do so, possibly resulting in large amounts of useless branch code.