Bug 34337 - gcc tries to interpret trigraphs in string constants
Summary: gcc tries to interpret trigraphs in string constants
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-04-02 13:34 UTC by Nils Philippsen
Modified: 2007-03-27 03:43 UTC (History)
0 users

Clone Of:
Last Closed: 2001-04-02 13:34:14 UTC

Attachments (Terms of Use)

Description Nils Philippsen 2001-04-02 13:34:11 UTC
Trying to compile this simple program:

--- 8< --- trigraph-error.c ---
#include <stdio.h>

int main (int argc, char **argv)
	puts ("Error (???) FIXME");
	return 1;
--- >8 ------------------------

with "gcc -Wall" results in this warning:

trigraph-error.c:5:24: warning: trigraph ??) ignored

I don't think that it's correct for gcc to try to interpret trigraphs
inside string constants.

Comment 1 Jakub Jelinek 2001-04-02 14:42:44 UTC
What's so special about trigraphs in string constants?
The warning you see is not about interpreting the trigraph, it is a
portability warning (the program will give different result when compiled
with -std=c89 (or -ansi or -std=c99) than without these options.
With e.g. C99 you get a different warning:
gcc -O2 -std=c99 -o o o.c -Wall
o.c:5:18: warning: trigraph ??) converted to ]
E.g. ISO C99 standard explicitely lists as an example that
does the same as
The only place where -Wtrigraphs does not warn in is in comments.

Note You need to log in before you can comment on or make changes to this bug.