[Bug c++/80716] New: Death by Documentation (SEGFAULT)

breakpoint at runbox dot com gcc-bugzilla@gcc.gnu.org
Thu May 11 22:17:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80716

            Bug ID: 80716
           Summary: Death by Documentation (SEGFAULT)
           Product: gcc
           Version: 6.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: breakpoint at runbox dot com
  Target Milestone: ---

This bug is odd, in that it looks like it must be a preprocessor problem, but
it seems to be the compiler itself that is crashing.

Verbatim minimal code:


#define DEATH_BY_DOCUMENTATION

class dismissed {
    public:
        dismissed() {
            // Construct the tree used for depth-first traversal testing.
            //
            // The tree has this structure:
            //
            //              1
            //             /|\
            //            2 7 8
            //           /|   |\
            //          3 6   9 12
            //         /|     |\
            //        4 5    10 11
        }
};



No lines have trailing whitespace.  Line 19 consists of a newline only and ends
the file.

Causes a segmentation fault in gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
(Fedora 25, 64-bit):

 internal compiler error: Segmentation fault
 #define DEATH_BY_DOCUMENTATION

Please submit a full bug report,
with preprocessed source if appropriate.


Flags: -O0 -g -ggdb3 -gdwarf-4 -fvar-tracking -fvar-tracking-assignments
-DGTEST_USE_OWN_TR1_TUPLE=0 -DGTEST_HAS_PTHREAD=1 -Dgtest_build_tests=ON
-DHAVE_EXPAT_CONFIG_H -std=gnu++03 -Wno-error=vla

Most extraneous material has been stripped.  The #define is required, but the
symbol seems to be irrelevant.  Adding newlines and/or semicolons before the
#define does not change the result.

Removing the #define avoids the segfault, and results in:

xxx.cpp:11:13: error: multi-line comment [-Werror=comment]
             //             /|\
             ^
xxx.cpp:13:13: error: multi-line comment [-Werror=comment]
             //           /|   |\
             ^
xxx.cpp:15:13: error: multi-line comment [-Werror=comment]
             //         /|     |\


This is part of a larger build, but unfortunately, that is composed of
proprietary material.  So, this report may be mostly useful as additional data
for a similar bug, if anyone knows of one that exists, or may point out some
material that needs a code review.

If built as a standalone a.out with a token main(){}, all goes well.  However,
the code above is verbatim from our minimal crash case in the larger build;
note that it has no #includes.

It is possible, but unlikely, that this is somehow related to cotire; if I
figure that out, I'll add it in.

Does anyone know of any rough edges related to escape sequences in comments, or
possibly trigraphs or something that seem like they might be related to this?

Thanks.


More information about the Gcc-bugs mailing list