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

            Bug ID: 57725
           Summary: conflicting language extensions
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbeulich at novell dot com

Created attachment 30369
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30369&action=edit
shared header

Both the "Arrays of Length Zero" and the "Structures With No Members"
extensions conflict with __attribute__((visibility())) (or the respective
pragma) when specifying other than the default visibility: Both of the named
extensions can result in two distinct objects being at the same address, yet
address comparisons for two distinct symbols with non-default visibility
generally get optimized with the assumption that they can't be equal.

The example files I'm going to attach show further problems in this area: The
results here should neither depend on architecture, nor on whether the objects
in question have an initializer. Nevertheless the behavior differs between x86
(both 32-bit and 64-bit) and e.g. ia64 or ARM64 (initialized objects, while
being of zero size, get allocated at distinct addresses for x86 but not for
ia64 and ARM64). Similarly, common data objects (i.e. when there's no
initializer) end up without padding for all architectures I tried this for, but
at least on x86 objects placed in .bss by the compiler get 1-byte padding added
between them.

The example code consists of
- a shared header, empty.h,
- a main source file, empty.c,
- two auxiliary source files, empty-bss.c and empty-comm.c.
The first source file should be compiled together with either of the two
auxiliary files, once with just '-Wall -O2' and another time with '-Wall -O2
-DVISIBILITY="hidden"'. The output will vary between the four executables
created, even though it should be consistent for all of them.

Reply via email to