http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48777

           Summary: duplicate pointers to empty structs passed as
                    arguments to function
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: m...@edg.com


#if OKAY
typedef int TYPE;
#elif ALSO_OKAY
struct A { int i; };
typedef struct A TYPE;
#else
struct A {};
typedef struct A TYPE;
#endif

int f(TYPE *a1, TYPE *a2) {
  return a1 == a2;
}
int main(void) {
  TYPE a1, a2;
  return f(&a1, &a2);
}

When OKAY or ALSO_OKAY are defined, unique addresses are passed for the
arguments to "f", but when an empty struct is used, the same address is passed
for both arguments (causing the function "f" to return 1).

This regression appears to have been introduced in 4.0.0 and exists through
4.5.2 (the latest version I have).

Thanks,

Mike.

Reply via email to