public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/31182]  New: preprocessor doubles up digits in token pasting
@ 2007-03-15  3:30 dsb at boyski dot com
  2007-03-15  4:35 ` [Bug preprocessor/31182] " fang at csl dot cornell dot edu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dsb at boyski dot com @ 2007-03-15  3:30 UTC (permalink / raw)
  To: gcc-bugs

Very simple test case:

% cat /tmp/ff.s
#define Concat(a,b)     a##b
Concat(foo,2.2)

% cpp -P /tmp/ff.s
foo22.2

Notice that what should be "2.2" becomes "22.2". Also note that this occurs
while preprocessing assembler (-x assembler-with-cpp) code.


-- 
           Summary: preprocessor doubles up digits in token pasting
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dsb at boyski dot com
 GCC build triplet: i386-pc-solaris2.10
  GCC host triplet: i386-pc-solaris2.10
GCC target triplet: i386-pc-solaris2.10


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


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

* [Bug preprocessor/31182] preprocessor doubles up digits in token pasting
  2007-03-15  3:30 [Bug preprocessor/31182] New: preprocessor doubles up digits in token pasting dsb at boyski dot com
@ 2007-03-15  4:35 ` fang at csl dot cornell dot edu
  2007-03-15 12:42 ` dsb at boyski dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fang at csl dot cornell dot edu @ 2007-03-15  4:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fang at csl dot cornell dot edu  2007-03-15 04:35 -------
Subject: Re:  preprocessor doubles up digits in token
 pasting

With your example, "g++ -E -"

gives me:
<stdin>:2:1: error: pasting "foo2" and "2.2" does not give a valid
preprocessing token
foo22.2

with versions 4.0.1 (powerpc-apple-darwin8)
and 4.2.0 (20070221)


while "cpp -P" (4.0.1) gives me
foo##2.2

and "cpp -P" (4.2.0) gives me
<stdin>:2:1: error: pasting "foo" and "2.2" does not give a valid
preprocessing token
foo22.2

and "cpp -P -traditional" (4.0.1, 4.2.0) give me
foo##2.2


Most odd...


-- 


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


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

* [Bug preprocessor/31182] preprocessor doubles up digits in token pasting
  2007-03-15  3:30 [Bug preprocessor/31182] New: preprocessor doubles up digits in token pasting dsb at boyski dot com
  2007-03-15  4:35 ` [Bug preprocessor/31182] " fang at csl dot cornell dot edu
@ 2007-03-15 12:42 ` dsb at boyski dot com
  2007-03-15 12:44 ` dsb at boyski dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dsb at boyski dot com @ 2007-03-15 12:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dsb at boyski dot com  2007-03-15 12:42 -------
This is because the default behavior is to preprocess in C mode but as I
mentioned it happens in assembler mode. If you add the flag '-x
assembler-with-cpp' you should see the reported result. My test case was in a
file with a .s extension which causes cpp/gcc to infer '-x assembler-with-cpp'.


-- 


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


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

* [Bug preprocessor/31182] preprocessor doubles up digits in token pasting
  2007-03-15  3:30 [Bug preprocessor/31182] New: preprocessor doubles up digits in token pasting dsb at boyski dot com
  2007-03-15  4:35 ` [Bug preprocessor/31182] " fang at csl dot cornell dot edu
  2007-03-15 12:42 ` dsb at boyski dot com
@ 2007-03-15 12:44 ` dsb at boyski dot com
  2007-03-15 16:28 ` tromey at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dsb at boyski dot com @ 2007-03-15 12:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dsb at boyski dot com  2007-03-15 12:44 -------
(when I said "this" I meant to refer to the "invalid token" warnings)


-- 


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


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

* [Bug preprocessor/31182] preprocessor doubles up digits in token pasting
  2007-03-15  3:30 [Bug preprocessor/31182] New: preprocessor doubles up digits in token pasting dsb at boyski dot com
                   ` (2 preceding siblings ...)
  2007-03-15 12:44 ` dsb at boyski dot com
@ 2007-03-15 16:28 ` tromey at gcc dot gnu dot org
  2007-03-16 12:58 ` dsb at boyski dot com
  2007-04-25  0:29 ` tromey at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-03-15 16:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tromey at gcc dot gnu dot org  2007-03-15 16:28 -------
I think this is probably the same thing as bug #28709,
and most likely fixed by the same patch.


-- 

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=31182


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

* [Bug preprocessor/31182] preprocessor doubles up digits in token pasting
  2007-03-15  3:30 [Bug preprocessor/31182] New: preprocessor doubles up digits in token pasting dsb at boyski dot com
                   ` (3 preceding siblings ...)
  2007-03-15 16:28 ` tromey at gcc dot gnu dot org
@ 2007-03-16 12:58 ` dsb at boyski dot com
  2007-04-25  0:29 ` tromey at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dsb at boyski dot com @ 2007-03-16 12:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dsb at boyski dot com  2007-03-16 12:58 -------
I just downloaded the latest 4.2 snapshot (gcc-4.2-20070307) and built it but
the behavior is the same. Given that the bugfix cited there dates back to
October and that it says "Known to work: 4.2.0"  I assume the patch is present
here so it appears to be different from
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28709


-- 


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


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

* [Bug preprocessor/31182] preprocessor doubles up digits in token pasting
  2007-03-15  3:30 [Bug preprocessor/31182] New: preprocessor doubles up digits in token pasting dsb at boyski dot com
                   ` (4 preceding siblings ...)
  2007-03-16 12:58 ` dsb at boyski dot com
@ 2007-04-25  0:29 ` tromey at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-04-25  0:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from tromey at gcc dot gnu dot org  2007-04-25 01:29 -------
This is fixed by the follow-on patch in PR 28709, see:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28709#c5


*** This bug has been marked as a duplicate of 28709 ***


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2007-04-25  0:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-15  3:30 [Bug preprocessor/31182] New: preprocessor doubles up digits in token pasting dsb at boyski dot com
2007-03-15  4:35 ` [Bug preprocessor/31182] " fang at csl dot cornell dot edu
2007-03-15 12:42 ` dsb at boyski dot com
2007-03-15 12:44 ` dsb at boyski dot com
2007-03-15 16:28 ` tromey at gcc dot gnu dot org
2007-03-16 12:58 ` dsb at boyski dot com
2007-04-25  0:29 ` tromey 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).