* [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
@ 2007-02-16 1:34 ` pinskia at gcc dot gnu dot org
2007-02-19 21:10 ` mmitchel at gcc dot gnu dot org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-16 1:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-02-16 01:34 -------
3.0.4 and 2.95.3 did not ICE on this. Confirmed a regression. I don't know if
this is valid or not.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Known to fail| |3.3.3 4.1.2 4.2.0 4.0.4
Known to work| |3.0.4 2.95.3
Last reconfirmed|0000-00-00 00:00:00 |2007-02-16 01:34:25
date| |
Summary|Internal compiler error when|[4.1/4.2/4.3 Regression]
|using "x##,##__VA_ARGS__" in|Internal compiler error when
|macro |using "x##,##__VA_ARGS__" in
| |macro
Target Milestone|--- |4.1.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
2007-02-16 1:34 ` [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
@ 2007-02-19 21:10 ` mmitchel at gcc dot gnu dot org
2007-02-19 22:20 ` joseph at codesourcery dot com
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-19 21:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from mmitchel at gcc dot gnu dot org 2007-02-19 21:09 -------
Joseph --
Is this valid code?
Thanks,
-- Mark
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |joseph at codesourcery dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
2007-02-16 1:34 ` [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2007-02-19 21:10 ` mmitchel at gcc dot gnu dot org
@ 2007-02-19 22:20 ` joseph at codesourcery dot com
2007-03-05 3:56 ` mmitchel at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: joseph at codesourcery dot com @ 2007-02-19 22:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from joseph at codesourcery dot com 2007-02-19 22:20 -------
Subject: Re: [4.1/4.2/4.3 Regression] Internal
compiler error when using "x##,##__VA_ARGS__" in macro
The order of evaluation of ## operators is unspecified.
If the left ## is evaluated first, it tries to concatenate "1" with ",",
yielding undefined behavior (for some time GCC has diagnosed such attempts
at concatenation yielding invalid preprocessing tokens). If the right ##
is evaluated first, the GNU extension for concatenation of "," with empty
__VA_ARGS__ is engaged; this presumably should leave a placemarker token,
whose concatenation with "1" yields "1".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (2 preceding siblings ...)
2007-02-19 22:20 ` joseph at codesourcery dot com
@ 2007-03-05 3:56 ` mmitchel at gcc dot gnu dot org
2007-04-16 19:10 ` bonzini at gnu dot org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-03-05 3:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from mmitchel at gcc dot gnu dot org 2007-03-05 03:55 -------
The fact that the result is in any case unspecified, coupled with the obscurity
of the code, makes this a P2.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (3 preceding siblings ...)
2007-03-05 3:56 ` mmitchel at gcc dot gnu dot org
@ 2007-04-16 19:10 ` bonzini at gnu dot org
2007-10-31 17:37 ` tromey at gcc dot gnu dot org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: bonzini at gnu dot org @ 2007-04-16 19:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from bonzini at gnu dot org 2007-04-16 20:10 -------
What about a patch like this?
Index: macro.c
===================================================================
--- macro.c (revision 123691)
+++ macro.c (working copy)
@@ -499,9 +499,15 @@ paste_all_tokens (cpp_reader *pfile, con
rhs = *FIRST (context).ptoken++;
if (rhs->type == CPP_PADDING)
- abort ();
+ {
+ /* In obscure cases where the GNU extension ,##__VA_ARGS__ is
+ used, we can get a CPP_PADDING token here. Assert that we
+ can safely ignore it. */
+ if (rhs->flags & PASTE_LEFT)
+ abort ();
+ }
- if (!paste_tokens (pfile, &lhs, rhs))
+ else if (!paste_tokens (pfile, &lhs, rhs))
break;
}
while (rhs->flags & PASTE_LEFT);
--
bonzini at gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bonzini at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (4 preceding siblings ...)
2007-04-16 19:10 ` bonzini at gnu dot org
@ 2007-10-31 17:37 ` tromey at gcc dot gnu dot org
2007-10-31 19:12 ` tromey at gcc dot gnu dot org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-10-31 17:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from tromey at gcc dot gnu dot org 2007-10-31 17:37 -------
This patch makes gcc enter an infinite loop rather than ICEing.
--
tromey at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (5 preceding siblings ...)
2007-10-31 17:37 ` tromey at gcc dot gnu dot org
@ 2007-10-31 19:12 ` tromey at gcc dot gnu dot org
2007-11-01 18:21 ` tromey at gcc dot gnu dot org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-10-31 19:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from tromey at gcc dot gnu dot org 2007-10-31 19:12 -------
I'm testing a revised patch.
--
tromey at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |tromey at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2007-08-06 15:06:47 |2007-10-31 19:12:33
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2/4.3 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (6 preceding siblings ...)
2007-10-31 19:12 ` tromey at gcc dot gnu dot org
@ 2007-11-01 18:21 ` tromey at gcc dot gnu dot org
2007-11-01 18:28 ` [Bug preprocessor/30805] [4.1/4.2 " jakub at gcc dot gnu dot org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-11-01 18:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from tromey at gcc dot gnu dot org 2007-11-01 18:21 -------
Subject: Bug 30805
Author: tromey
Date: Thu Nov 1 18:20:48 2007
New Revision: 129827
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129827
Log:
libcpp
PR preprocessor/30805:
* macro.c (paste_tokens): Handle padding token.
(paste_tokens): Don't abort unless padding has PASTE_LEFT flag.
gcc/testsuite
PR preprocessor/30805:
* gcc.dg/cpp/pr30805.c: New file.
Added:
trunk/gcc/testsuite/gcc.dg/cpp/pr30805.c
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/libcpp/ChangeLog
trunk/libcpp/macro.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (7 preceding siblings ...)
2007-11-01 18:21 ` tromey at gcc dot gnu dot org
@ 2007-11-01 18:28 ` jakub at gcc dot gnu dot org
2007-11-01 23:25 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-01 18:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jakub at gcc dot gnu dot org 2007-11-01 18:27 -------
Fixed on the trunk.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work|3.0.4 2.95.3 |3.0.4 2.95.3 4.3.0
Summary|[4.1/4.2/4.3 Regression] |[4.1/4.2 Regression]
|Internal compiler error when|Internal compiler error when
|using "x##,##__VA_ARGS__" in|using "x##,##__VA_ARGS__" in
|macro |macro
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (8 preceding siblings ...)
2007-11-01 18:28 ` [Bug preprocessor/30805] [4.1/4.2 " jakub at gcc dot gnu dot org
@ 2007-11-01 23:25 ` jakub at gcc dot gnu dot org
2007-11-01 23:34 ` tromey at gcc dot gnu dot org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-01 23:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jakub at gcc dot gnu dot org 2007-11-01 23:25 -------
The testcase fails btw:
Executing on host: /usr/src/gcc/obj/gcc/xgcc -B/usr/src/gcc/obj/gcc/
/usr/src/gcc/gcc/testsuite/gcc.dg/cpp/pr30805.c -ansi -pedantic-errors
-fno-show-column -E -o pr30805.i (timeout = 300)
/usr/src/gcc/gcc/testsuite/gcc.dg/cpp/pr30805.c:4: error: anonymous variadic
macros were introduced in C99
/usr/src/gcc/gcc/testsuite/gcc.dg/cpp/pr30805.c:5: error: ISO C99 requires rest
arguments to be used
compiler exited with status 1
output is:
/usr/src/gcc/gcc/testsuite/gcc.dg/cpp/pr30805.c:4: error: anonymous variadic
macros were introduced in C99
/usr/src/gcc/gcc/testsuite/gcc.dg/cpp/pr30805.c:5: error: ISO C99 requires rest
arguments to be used
FAIL: gcc.dg/cpp/pr30805.c (test for excess errors)
Excess errors:
/usr/src/gcc/gcc/testsuite/gcc.dg/cpp/pr30805.c:4: error: anonymous variadic
macros were introduced in C99
/usr/src/gcc/gcc/testsuite/gcc.dg/cpp/pr30805.c:5: error: ISO C99 requires rest
arguments to be used
If I add
/* { dg-options "-std=gnu99" } */
(or -std=gnu89 or -std=c99), then it fails with:
pr30805.c:6: error: expected identifier or `(' before numeric constant
It doesn't ICE in either case (and ICEd with older cc1). Now if the above
error message is correct, we should add the dg-options line and dg-error for
this error.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (9 preceding siblings ...)
2007-11-01 23:25 ` jakub at gcc dot gnu dot org
@ 2007-11-01 23:34 ` tromey at gcc dot gnu dot org
2007-11-01 23:39 ` tromey at gcc dot gnu dot org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-11-01 23:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from tromey at gcc dot gnu dot org 2007-11-01 23:34 -------
Sorry about that. I don't know what went wrong.
The test should only be preprocessed, not compiled.
I will fix this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.1/4.2 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (10 preceding siblings ...)
2007-11-01 23:34 ` tromey at gcc dot gnu dot org
@ 2007-11-01 23:39 ` tromey at gcc dot gnu dot org
2008-07-04 21:57 ` [Bug preprocessor/30805] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 21:35 ` jsm28 at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-11-01 23:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from tromey at gcc dot gnu dot org 2007-11-01 23:39 -------
Subject: Bug 30805
Author: tromey
Date: Thu Nov 1 23:38:52 2007
New Revision: 129838
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129838
Log:
PR preprocessor/30805:
* gcc.dg/cpp/pr30805.c: Use -std=gnu89.
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/cpp/pr30805.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.2 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (11 preceding siblings ...)
2007-11-01 23:39 ` tromey at gcc dot gnu dot org
@ 2008-07-04 21:57 ` jsm28 at gcc dot gnu dot org
2009-03-30 21:35 ` jsm28 at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from jsm28 at gcc dot gnu dot org 2008-07-04 21:57 -------
Closing 4.1 branch.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.1/4.2 Regression] |[4.2 Regression] Internal
|Internal compiler error when|compiler error when using
|using "x##,##__VA_ARGS__" in|"x##,##__VA_ARGS__" in macro
|macro |
Target Milestone|4.1.3 |4.2.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug preprocessor/30805] [4.2 Regression] Internal compiler error when using "x##,##__VA_ARGS__" in macro
2007-02-15 13:15 [Bug preprocessor/30805] New: Internal compiler error when using "x##,##__VA_ARGS__" in macro johandefries at gmail dot com
` (12 preceding siblings ...)
2008-07-04 21:57 ` [Bug preprocessor/30805] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 21:35 ` jsm28 at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 21:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from jsm28 at gcc dot gnu dot org 2009-03-30 21:34 -------
Closing 4.2 branch, fixed in 4.3.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to fail|3.3.3 4.1.2 4.2.0 4.0.4 |3.3.3 4.1.2 4.2.0 4.0.4
| |4.2.5
Resolution| |FIXED
Target Milestone|4.2.5 |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30805
^ permalink raw reply [flat|nested] 15+ messages in thread