public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/94535] New: __LINE__ value changed for macro invocations spanning multiple lines
@ 2020-04-08 20:17 alisdairm at me dot com
  2020-04-08 20:21 ` [Bug preprocessor/94535] " pinskia at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: alisdairm at me dot com @ 2020-04-08 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94535
           Summary: __LINE__ value changed for macro invocations spanning
                    multiple lines
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alisdairm at me dot com
  Target Milestone: ---

Given the following simple program, the line that static_asserts changed from
gcc 8 to gcc 9 (and remains so for current trunk prior to 10's release):

#define LINE(DUMMY) __LINE__

constexpr int X = LINE(
                       wrap);

static_assert(X == 3); // gcc 8 and earlier, non-gcc compilers
static_assert(X == 4); // gcc 9 and 10

Note that every other compiler I have access to has the original gcc 8
behavior.
(tested widely with Godbolt compiler explorer, and on Solaris/AIX with native
compilers)

Unsurprisingly, this is breaking unit tests and other code similarly sensitive
to line numbers.

Godbolt link for quick testing: https://godbolt.org/z/LU--gC

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-05-15 14:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 20:17 [Bug preprocessor/94535] New: __LINE__ value changed for macro invocations spanning multiple lines alisdairm at me dot com
2020-04-08 20:21 ` [Bug preprocessor/94535] " pinskia at gcc dot gnu.org
2020-04-08 20:33 ` [Bug preprocessor/94535] __LINE__ value changed for funciton " alisdairm at me dot com
2020-04-08 20:48 ` [Bug preprocessor/94535] __LINE__ value changed for function-like " pinskia at gcc dot gnu.org
2020-04-08 20:55 ` alisdairm at me dot com
2020-04-08 20:57 ` pinskia at gcc dot gnu.org
2020-04-08 21:00 ` msebor at gcc dot gnu.org
2020-04-08 21:18 ` alisdairm at me dot com
2020-04-08 21:20 ` alisdairm at me dot com
2020-04-08 21:33 ` alisdairm at me dot com
2020-04-08 21:36 ` msebor at gcc dot gnu.org
2020-04-09  8:25 ` jakub at gcc dot gnu.org
2020-05-15 14:04 ` alisdairm at me dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).