[Bug c++/22488] C++ frontend generates RECORD_TYPEs with overlapping FIELD_DECLs

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 2 08:04:00 GMT 2013


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.6.4                       |---
            Summary|[4.6/4.7/4.8/4.9            |C++ frontend generates
                   |Regression]                 |RECORD_TYPEs with
                   |push_fields_onto_fieldstack |overlapping FIELD_DECLs
                   |calculates offset           |
                   |incorrectly                 |

--- Comment #57 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-02 08:04:05 UTC ---
Re-confirmed and summary adjusted.  The code in tree-ssa-structalias.c is
still there:

      /* We can't sort them if we have a field with a variable sized type,
         which will make notokay = true.  In that case, we are going to return
         without creating varinfos for the fields anyway, so sorting them is a
         waste to boot.  */
      if (!notokay)
        {
          sort_fieldstack (fieldstack);
          /* Due to some C++ FE issues, like PR 22488, we might end up
             what appear to be overlapping fields even though they,
             in reality, do not overlap.  Until the C++ FE is fixed,
             we will simply disable field-sensitivity for these cases.  */
          notokay = check_for_overlaps (fieldstack);

I am not aware of other code in the middle-end that might be confused
about this issue (well, SRA maybe, but it handles overlaps well as it
also handles accesses to unions).

I believe that the C++ frontend issue might not be a regression after all,
the tree-ssa-structalias.c "regression" was fixed by the above kludge.

The C++ frontend issue makes it impossible to implement a GENERIC verifier
for RECORD_TYPEs (verify FIELD_DECLs are sorted after offset and not
overlapping).



More information about the Gcc-bugs mailing list