public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/34692]  New: [4.2/4.3 regression]
@ 2008-01-06 21:47 reichelt at gcc dot gnu dot org
  2008-01-06 21:48 ` [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with prgama in macro reichelt at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-01-06 21:47 UTC (permalink / raw)
  To: gcc-bugs

The following testcase triggers an internal error in the preprocessor
since GCC 4.2.0:

================================
#define FOO(expr) (#expr)

FOO(
#pragma GCC diagnostic
)
================================

bug.c:5:1: internal error: unspellable token PRAGMA
bug.c:5:1: internal error: unspellable token PRAGMA_EOL
bug.c:3: error: expected identifier or '(' before string constant

This is similar to PR34602, but not yet fixed on mainline.


-- 
           Summary: [4.2/4.3 regression]
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with prgama in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
@ 2008-01-06 21:48 ` reichelt at gcc dot gnu dot org
  2008-01-06 22:31 ` [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma " pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-01-06 21:48 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |34602
           Keywords|                            |ice-on-invalid-code
            Summary|[4.2/4.3 regression]        |[4.2/4.3 regression]
                   |                            |Internal error with prgama
                   |                            |in macro
   Target Milestone|---                         |4.2.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
  2008-01-06 21:48 ` [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with prgama in macro reichelt at gcc dot gnu dot org
@ 2008-01-06 22:31 ` pinskia at gcc dot gnu dot org
  2008-01-07 21:19 ` tromey at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-06 22:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-01-06 22:14 -------
I think this was introduced with the pragma changes from the openmp branch.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
  2008-01-06 21:48 ` [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with prgama in macro reichelt at gcc dot gnu dot org
  2008-01-06 22:31 ` [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma " pinskia at gcc dot gnu dot org
@ 2008-01-07 21:19 ` tromey at gcc dot gnu dot org
  2008-01-09 21:23 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-01-07 21:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tromey at gcc dot gnu dot org  2008-01-07 20:18 -------
Confirmed.
4.1 seems to have silently accepted this.
I will try to read the standard to figure out what is correct.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-07 20:18:16
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-01-07 21:19 ` tromey at gcc dot gnu dot org
@ 2008-01-09 21:23 ` jakub at gcc dot gnu dot org
  2008-01-11  8:52 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-01-09 21:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2008-01-09 19:44 -------
ISO C99, 6.3.10, paragraph 11 contains:
"If there are sequences of preprocessing tokens within the list of arguments
that would otherwise act as preprocessing directives, the behavior is
undefined."
GCC 3.2.x had:
      if (token->type == CPP_HASH)
        {
          cpp_error (pfile,
                     "directives may not be used inside a macro argument");
          step_back = true;
        }
then http://gcc.gnu.org/ml/gcc-patches/2002-02/msg01905.html changed that.
I'd say doing what 4.1 did is sane, say for:
#define FOO(y, x) y #x
FOO(const char *p =,
a
#pragma GCC visibility push(hidden)
b
cde f g h
);
int v = 6;
#pragma GCC visibility pop
gcc -E would output:
# 1 "/tmp/V.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/tmp/V.c"



#pragma GCC visibility push(hidden)
const char *p = "a b cde f g h";


int v = 6;
#pragma GCC visibility pop
and gcc -S would:
        .file   "V.c"
        .hidden p
.globl p
        .section        .rodata.str1.1,"aMS",@progbits,1
.LC0:
        .string "a b cde f g h"
        .data
        .align 8
        .type   p, @object
        .size   p, 8
p:
        .quad   .LC0
        .hidden v
.globl v
        .align 4
        .type   v, @object
        .size   v, 4
v:
        .long   6
        .ident  "GCC: (GNU) 4.1.3 20070822 (prerelease)"
        .section        .note.GNU-stack,"",@progbits


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-01-09 21:23 ` jakub at gcc dot gnu dot org
@ 2008-01-11  8:52 ` jakub at gcc dot gnu dot org
  2008-01-23 16:36 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-01-11  8:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-01-11  8:52 ` jakub at gcc dot gnu dot org
@ 2008-01-23 16:36 ` jakub at gcc dot gnu dot org
  2008-01-25  9:44 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-01-23 16:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2008-01-23 15:59 -------
Testing a patch.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-01-07 20:18:16         |2008-01-23 15:59:04
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-01-23 16:36 ` jakub at gcc dot gnu dot org
@ 2008-01-25  9:44 ` jakub at gcc dot gnu dot org
  2008-01-25  9:47 ` [Bug preprocessor/34692] [4.2 " jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-01-25  9:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2008-01-25 09:02 -------
Subject: Bug 34692

Author: jakub
Date: Fri Jan 25 09:01:27 2008
New Revision: 131819

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131819
Log:
        PR preprocessor/34692
        * macro.c (collect_args): Add pragma_buff argument.  Push
        CPP_PRAGMA ... CPP_PRAGMA_EOL tokens to *pragma_buff, rather
        than into arguments.  Reset prevent_expansion and parsing_args
        state at CPP_PRAGMA_EOL/CPP_EOF.
        (funlike_invocation_p): Add pragma_buff argument, pass it through
        to collect_args.
        (enter_macro_context): Add result argument.  Adjust
        funlike_invocation_p caller.  Emit all deferred pragma tokens
        gathered during collect_args before the expansion, add a padding
        token.  Return 2 instead of 1 if any pragma tokens were prepended.
        (cpp_get_token): If enter_macro_context returns 2, don't return
        a padding token, instead cycle to grab CPP_PRAGMA token.
        * directives.c (_cpp_handle_directive): If was_parsing_args
        in deferred pragma, leave parsing_args and prevent_expansion as is.

        * gcc.dg/cpp/pr34692.c: New test.
        * gcc.dg/gomp/pr34692.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/cpp/pr34692.c
    trunk/gcc/testsuite/gcc.dg/gomp/pr34692.c
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/directives.c
    trunk/libcpp/macro.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-01-25  9:44 ` jakub at gcc dot gnu dot org
@ 2008-01-25  9:47 ` jakub at gcc dot gnu dot org
  2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-01-25  9:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2008-01-25 09:14 -------
Fixed on the trunk.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.2/4.3 regression]        |[4.2 regression] Internal
                   |Internal error with pragma  |error with pragma in macro
                   |in macro                    |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-01-25  9:47 ` [Bug preprocessor/34692] [4.2 " jakub at gcc dot gnu dot org
@ 2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
  2008-05-19 20:32 ` jsm28 at gcc dot gnu dot org
  2009-03-31 14:58 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-02-01 17:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jsm28 at gcc dot gnu dot org  2008-02-01 16:55 -------
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.3                       |4.2.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
@ 2008-05-19 20:32 ` jsm28 at gcc dot gnu dot org
  2009-03-31 14:58 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-05-19 20:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jsm28 at gcc dot gnu dot org  2008-05-19 20:24 -------
4.2.4 is being released, changing milestones to 4.2.5.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.4                       |4.2.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

* [Bug preprocessor/34692] [4.2 regression] Internal error with pragma in macro
  2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2008-05-19 20:32 ` jsm28 at gcc dot gnu dot org
@ 2009-03-31 14:58 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 14:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jsm28 at gcc dot gnu dot org  2009-03-31 14:58 -------
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|                            |4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34692


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

end of thread, other threads:[~2009-03-31 14:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-06 21:47 [Bug preprocessor/34692] New: [4.2/4.3 regression] reichelt at gcc dot gnu dot org
2008-01-06 21:48 ` [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with prgama in macro reichelt at gcc dot gnu dot org
2008-01-06 22:31 ` [Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma " pinskia at gcc dot gnu dot org
2008-01-07 21:19 ` tromey at gcc dot gnu dot org
2008-01-09 21:23 ` jakub at gcc dot gnu dot org
2008-01-11  8:52 ` jakub at gcc dot gnu dot org
2008-01-23 16:36 ` jakub at gcc dot gnu dot org
2008-01-25  9:44 ` jakub at gcc dot gnu dot org
2008-01-25  9:47 ` [Bug preprocessor/34692] [4.2 " jakub at gcc dot gnu dot org
2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
2008-05-19 20:32 ` jsm28 at gcc dot gnu dot org
2009-03-31 14:58 ` jsm28 at gcc dot gnu dot org

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).