public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/51745] New: Strange symbol appears when using commandline definition without "="
@ 2012-01-03 21:42 mikulas at artax dot karlin.mff.cuni.cz
2012-01-03 21:48 ` [Bug preprocessor/51745] " redi at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: mikulas at artax dot karlin.mff.cuni.cz @ 2012-01-03 21:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51745
Bug #: 51745
Summary: Strange symbol appears when using commandline
definition without "="
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: preprocessor
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mikulas@artax.karlin.mff.cuni.cz
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
If we use -D definition without "=" in the command line, strange unwanted
symbol "1" appears in the output.
How to reproduce: run gcc -E - -o - "-Dblabla(x, y) bleble[x,y]"
Type blabla(2,3) and press Ctrl-D.
The output is: bleble[2,3] 1
The symbol "1" was never defined anywhere. There is something strange going on
in the commandline parsing. Such syntax without "=" should be either rejected
with an error or it should be processed correctly.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/51745] Strange symbol appears when using commandline definition without "="
2012-01-03 21:42 [Bug preprocessor/51745] New: Strange symbol appears when using commandline definition without "=" mikulas at artax dot karlin.mff.cuni.cz
@ 2012-01-03 21:48 ` redi at gcc dot gnu.org
2012-01-04 10:22 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2012-01-03 21:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51745
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-03 21:48:19 UTC ---
In other words:
$ echo foo | gcc -E - -o - "-Dfoo bar"
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
bar 1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/51745] Strange symbol appears when using commandline definition without "="
2012-01-03 21:42 [Bug preprocessor/51745] New: Strange symbol appears when using commandline definition without "=" mikulas at artax dot karlin.mff.cuni.cz
2012-01-03 21:48 ` [Bug preprocessor/51745] " redi at gcc dot gnu.org
@ 2012-01-04 10:22 ` rguenth at gcc dot gnu.org
2012-01-04 11:10 ` jakub at gcc dot gnu.org
2012-01-10 18:59 ` mikulas at artax dot karlin.mff.cuni.cz
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-04 10:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51745
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-01-04
Ever Confirmed|0 |1
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-04 10:21:49 UTC ---
Strangely ICC agrees with GCC here (hopefully using its own preprocessor ;))
So, confirmed, but maybe invalid.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/51745] Strange symbol appears when using commandline definition without "="
2012-01-03 21:42 [Bug preprocessor/51745] New: Strange symbol appears when using commandline definition without "=" mikulas at artax dot karlin.mff.cuni.cz
2012-01-03 21:48 ` [Bug preprocessor/51745] " redi at gcc dot gnu.org
2012-01-04 10:22 ` rguenth at gcc dot gnu.org
@ 2012-01-04 11:10 ` jakub at gcc dot gnu.org
2012-01-10 18:59 ` mikulas at artax dot karlin.mff.cuni.cz
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-04 11:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51745
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-04 11:10:07 UTC ---
The 1 comes likely from -Dfoo being equivalent to Dfoo=1 if there is no = on
the command line, and as the preprocessor internally doesn't use = signs but
spaces after macro name, we append " 1". -D"foo bar" is thus expanded as
-D"foo bar 1". "processed correctly" means what exactly? You can't define
macro blabla(x, y) bleble[x,y], C doesn't have macros with spaces in the names.
Garbage in garbage out in my eyes.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/51745] Strange symbol appears when using commandline definition without "="
2012-01-03 21:42 [Bug preprocessor/51745] New: Strange symbol appears when using commandline definition without "=" mikulas at artax dot karlin.mff.cuni.cz
` (2 preceding siblings ...)
2012-01-04 11:10 ` jakub at gcc dot gnu.org
@ 2012-01-10 18:59 ` mikulas at artax dot karlin.mff.cuni.cz
3 siblings, 0 replies; 5+ messages in thread
From: mikulas at artax dot karlin.mff.cuni.cz @ 2012-01-10 18:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51745
--- Comment #4 from mikulas at artax dot karlin.mff.cuni.cz 2012-01-10 18:59:06 UTC ---
If you input garbage into a compiler, it should report an error, not output
garbage.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-10 18:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-03 21:42 [Bug preprocessor/51745] New: Strange symbol appears when using commandline definition without "=" mikulas at artax dot karlin.mff.cuni.cz
2012-01-03 21:48 ` [Bug preprocessor/51745] " redi at gcc dot gnu.org
2012-01-04 10:22 ` rguenth at gcc dot gnu.org
2012-01-04 11:10 ` jakub at gcc dot gnu.org
2012-01-10 18:59 ` mikulas at artax dot karlin.mff.cuni.cz
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).