Hello!

  I found something rather odd in testcase gcc.c-torture/execute/20030811-1.c:

> /* Origin: PR target/11535 from H. J. Lu <h...@lucon.org> */
> > void vararg (int i, ...)
> {
>   (void) i;
> }
> > int i0[0], i1;

  Huh?

> void test1 (void)
> {
>   int a = (int) (long long) __builtin_return_address (0);
>   vararg (0, a);
> }
> > void test2 (void)
> {
>   i0[0] = (int) (long long) __builtin_return_address (0);
> }

  Nasal demons?

> void test3 (void)
> {
>   i1 = (int) (long long) __builtin_return_address (0);
> }
> > void test4 (void)
> {
>   volatile long long a = (long long) __builtin_return_address (0);
>   i0[0] = (int) a;
> }

And testing it on Linux, I see that the linker goes ahead and assigns zero
bytes of the common area to i0, then assigns four bytes of common space to i1
at the same address, so writing to i0[0] aliases and alters i1.  That
certainly sounds like undefined behaviour to me!

It looks like a typo in the testcase to me, but let's add some CCs to be sure.

Uros.

Reply via email to