This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/51990] ICE in copy_reference_ops_from_ref
- From: "vries at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Jan 2012 10:15:53 +0000
- Subject: [Bug tree-optimization/51990] ICE in copy_reference_ops_from_ref
- Auto-submitted: auto-generated
- References: <bug-51990-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51990
--- Comment #3 from vries at gcc dot gnu.org 2012-01-25 10:15:53 UTC ---
(In reply to comment #2)
> This extension is not even documented, see PR 37428 for more info.
>
There are at least these 3 examples in the testsuite that use this extension:
gcc.c-torture/compile/20030224-1.c
gcc.c-torture/execute/20020412-1.c
gcc.dg/lto/20090706-1_0.c
These 3 tests fail (in unmodified form) with my patch for PR51879 (see PR51879
comment 7) on this ICE.
> I want to say this example is invalid as the function foo does not have enough
> info about the size of struct s.
If the example is indeed valid, it would be nice if the compiler at least
warned about that.
Either way, the last 2 tests listed above use (int, ...) as prototype. IIUC,
using that prototype would remove your concern about invalidity. Using that
prototype instead, I get the same ICE:
...
int
zzz (char *s1, char *s2, int len, int *q)
{
int z = 5;
unsigned int i, b;
struct s { char a[z]; };
struct s x;
extern int foo (int, ...) __attribute__((pure));
for (i = 0; i < len; i++)
s1[i] = s2[i];
b = z & 0x3;
len += (b == 0 ? 0 : 1) + z;
*q = len;
return foo (z, x, x);
}
...
I suppose another way to achieve the same is to use a nested function:
...
__attribute__((pure,noinline)) int foo (struct s s1, struct s s2)
{
return 0;
}
...