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

            Bug ID: 118770
           Summary: Random Segmentation fault in preprocessor from _Pragma
                    push pop within _Pragma
           Product: gcc
           Version: 14.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ymity.me at gmail dot com
  Target Milestone: ---

Created attachment 60394
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60394&action=edit
Crash log, gcc -v, file which caused crash from 2 diffrent devices.

"Random" Segmentation fault caused by calling _Pragma push_macro & _Pragma
pop_macro within _Pragma. Tested on two different devices and was able to
recreate it iff: 3 more push pop occurred within _Pragma - I did worry it was a
hardware problem. 

Only occurred when calling gcc with -E flag

// Some function like macro
#define X() X

// Needs to call _Pragma from within _Pragma
// Needs to be done in another function.
#define POP()\
    _Pragma(                           \
        _Pragma("push_macro(\"X\")")     \
        _Pragma("pop_macro(\"X\")")      \
        "pop_macro(\"CRASH\")"           \
    )

// Have a infinite loop - Normal usecase Recursion.
#define CRASH()\
    _Pragma("push_macro(\"CRASH\")")   \
    POP()                              \
    CRASH()

CRASH()

Reply via email to