[Bug preprocessor/126929] New: unclear behavior of -std=c90 for the preprocessor

vincent-gcc at vinc17 dot net via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126929

            Bug ID: 126929
           Summary: unclear behavior of -std=c90 for the preprocessor
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent-gcc at vinc17 dot net
  Target Milestone: ---

When I compile the following code

#include <limits.h>
#if ULONG_MAX >= 0xffffffffffffffff
#error "true"
#else
#error "false"
#endif

with "gcc -c -std=c90 -m32" under Linux x86_64, I get the error on #error
"false".

In ISO C90, the preprocessor arithmetic is long or unsigned long, so that with
the 32-bit ABI, the test ULONG_MAX >= ... would always be true, and I would
expect the error on #error "true".

It is not clear whether the obtained result is incorrect, i.e. whether the -std
option affects the preprocessor. The GCC man page and manual say that -std=
determines the language standard (or dialect). But the behavior of the
preprocessor is part of the language standard. So this should be fixed and/or
clarified.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.