Bug 18502 - [3.3/3.4 Regression] trigraphs don't work with -std=gnu99
Summary: [3.3/3.4 Regression] trigraphs don't work with -std=gnu99
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.4.3
: P2 normal
Target Milestone: 3.4.4
Assignee: Joseph S. Myers
URL:
Keywords: diagnostic, patch
Depends on:
Blocks:
 
Reported: 2004-11-15 14:54 UTC by Lukas Mai
Modified: 2005-05-03 20:04 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 3.0.4
Known to fail: 3.2.3 3.3.4 3.4.3 4.0.0
Last reconfirmed: 2005-02-01 23:29:25


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Mai 2004-11-15 14:54:59 UTC
Hello,

$ echo '??-' | gcc -P -E -trigraphs -std=gnu99 -trigraphs -
<stdin>:1:1: warning: trigraph ??- ignored, use -trigraphs to enable
??-
$

That shouldn't happen. Apparently -trigraphs is ignored with -std=gnu99. Weird.

Lukas
Comment 1 Andrew Pinski 2004-11-15 15:15:45 UTC
Confirmed, the problem is either in the C front-end (which is really the code which drives the 
preprocessor library) or in the C driver part:
 /Users/pinskia/local/libexec/gcc/powerpc-apple-darwin7.6.0/4.0.0/cc1 -E -quiet -v -P -trigraphs 
-trigraphs -D__DYNAMIC__ -D__APPLE_CC__=1 - -fPIC -std=gnu99

Note how -std=gnu99 is done after -trigraphs.
Comment 2 jsm-csl@polyomino.org.uk 2004-11-15 15:51:23 UTC
Subject: Re:  trigraphs don't work with -std=gnu99

On Mon, 15 Nov 2004, pinskia at gcc dot gnu dot org wrote:

> Confirmed, the problem is either in the C front-end (which is really the code which drives the 
> preprocessor library) or in the C driver part:
>  /Users/pinskia/local/libexec/gcc/powerpc-apple-darwin7.6.0/4.0.0/cc1 -E -quiet -v -P -trigraphs 
> -trigraphs -D__DYNAMIC__ -D__APPLE_CC__=1 - -fPIC -std=gnu99
> 
> Note how -std=gnu99 is done after -trigraphs.

In that case the sorting needs to be disabled between these options just 
as -ansi and -std options are sorted together in specs (%{std*&ansi}, was 
bug 11459).

Comment 3 Joseph S. Myers 2005-02-01 23:29:24 UTC
This is a regression from 3.0.x.  Working on a patch.
Comment 4 Andrew Pinski 2005-02-02 18:55:16 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00173.html>.
Comment 5 GCC Commits 2005-02-02 23:01:30 UTC
Subject: Bug 18502

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2005-02-02 23:01:11

Modified files:
	gcc            : ChangeLog gcc.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr18502-1.c 

Log message:
	PR c/18502
	* gcc.c (cpp_unique_options): Remove %{trigraphs}.
	(cpp_options, cc1_options): Change %{std*&ansi} to
	%{std*&ansi&trigraphs}.
	
	testsuite:
	* gcc.dg/pr18502-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7378&r2=2.7379
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gcc.c.diff?cvsroot=gcc&r1=1.444&r2=1.445
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4985&r2=1.4986
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr18502-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 6 Andrew Pinski 2005-02-02 23:55:45 UTC
Fixed on the mainline at least (for 4.0.0) but really should also be fixed on the other open branches too.
Comment 8 Joseph S. Myers 2005-05-03 20:04:42 UTC
Fixed for 3.4.4.  Will not now be fixed on 3.3 branch.