Bug 1068811 - g++ abort on ??=ifndef but not for others trigraphs on preprocessor instructions
Summary: g++ abort on ??=ifndef but not for others trigraphs on preprocessor instructions
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 20
Hardware: All
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-21 23:13 UTC by Aurélien Rivière
Modified: 2014-03-03 11:16 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-03-03 11:16:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
my source code with the # replaced by ??= that makes gcc abort (177.76 KB, application/x-xz)
2014-02-24 16:34 UTC, Aurélien Rivière
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 60400 0 None None None Never

Description Aurélien Rivière 2014-02-21 23:13:01 UTC
Description of problem:
I have replaced the characters I could replace in a working simple C++ project with trigraphs in order to test it.
All the trigraphs where accepted and converted for the C++ code, but always for the preprocessor instructions.

Version-Release number of selected component (if applicable):
g++ (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)
Affects both 32 and 64bits releases.

How reproducible:
On a C++ file that has several preprocessor instructions, 
sed -i 's/#/??=/g' src/*
then compile with --trigraphs argument 

Actual results:
[nux@fedora alter-ego]$ g++ -W -Wall -Wextra -pedantic --trigraphs -g -ggdb -o build/intersection.o -c src/intersection.cpp
[...]
src/goban.h:5:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include <cassert>
 ^
In file included from src/go.h:7:0,
                 from src/go.cpp:1:
src/goban.h:6:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include <sstream>
 ^
In file included from src/go.cpp:1:0:

In file included from src/go.h:7:0,
                 from src/go.cpp:1:
src/goban.h:6:0: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make: *** [build/go.o] Error 1
[nux@fedora]$ head src/goban.h
??=ifndef GOBAN_H
??=define GOBAN_H

??=include <cstdarg>
??=include <cassert>
??=include <sstream>
??=include <list>
??=include "config.h"
??=include "intersection.h"


Expected results:
Only warnings, but no fail, and a successful build.

Additional info:
Works with clang++

Comment 1 Aurélien Rivière 2014-02-22 14:37:08 UTC
Sorry for the mistake on my second sentance and the omission of the "not". It's clearer like this :
All the trigraphs were accepted and converted for the C++ code, but not always for the ??= replacing # in the preprocessor instructions.

Comment 2 Jason Merrill 2014-02-24 14:09:13 UTC
Please provide a complete testcase.  Compiling your src/goban.h directly doesn't fail for me.

Comment 3 Aurélien Rivière 2014-02-24 16:34:44 UTC
Created attachment 867053 [details]
my source code with the # replaced by ??= that makes gcc abort

[nux@fedora alter-ego]$ sed -i 's/#/??=/g' src/*
[nux@fedora alter-ego]$ make clean
rm -rf alter-ego build
[nux@fedora alter-ego]$ make
mkdir -p build
g++ --trigraphs -W -Wall -Wextra -pedantic -g -ggdb -o build/intersection.o -c src/intersection.cpp
src/intersection.cpp:1:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include "intersection.h"
 ^
In file included from src/intersection.cpp:1:0:
src/intersection.h:1:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=ifndef INTERSECTION_H
 ^
src/intersection.h:2:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=define INTERSECTION_H
 ^
src/intersection.h:4:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include "config.h"
 ^
In file included from src/intersection.h:4:0,
                 from src/intersection.cpp:1:
src/config.h:1:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=ifndef CONFIG_H
 ^
src/config.h:2:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=define CONFIG_H
 ^
src/config.h:6:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=endif /* CONFIG_H */
 ^
In file included from src/intersection.cpp:1:0:
src/intersection.h:5:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include "group.h"
 ^
In file included from src/intersection.h:5:0,
                 from src/intersection.cpp:1:
src/group.h:1:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=ifndef GROUP_H
 ^
src/group.h:2:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=define GROUP_H
 ^
src/group.h:4:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include <list>
 ^
In file included from src/intersection.h:5:0,
                 from src/intersection.cpp:1:
src/group.h:5:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include <iostream>
 ^
In file included from src/intersection.h:5:0,
                 from src/intersection.cpp:1:
src/group.h:7:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include "config.h"
 ^
src/group.h:29:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=endif /* GROUP_H */ 
 ^
In file included from src/intersection.cpp:1:0:
src/intersection.h:26:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=endif /* INTERSECTION_H */ 
 ^
mkdir -p build
g++ --trigraphs -W -Wall -Wextra -pedantic -g -ggdb -o build/go.o -c src/go.cpp
src/go.cpp:1:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include "go.h"
 ^
In file included from src/go.cpp:1:0:
src/go.h:1:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=ifndef GO_H
 ^
src/go.h:2:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=define GO_H
 ^
src/go.h:4:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include <cassert>
 ^
In file included from src/go.cpp:1:0:
src/go.h:5:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include <sstream>
 ^
In file included from src/go.cpp:1:0:
src/go.h:6:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include "config.h"
 ^
In file included from src/go.h:6:0,
                 from src/go.cpp:1:
src/config.h:1:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=ifndef CONFIG_H
 ^
src/config.h:2:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=define CONFIG_H
 ^
src/config.h:6:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=endif /* CONFIG_H */
 ^
In file included from src/go.cpp:1:0:
src/go.h:7:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include "error.h"
 ^
In file included from src/go.h:7:0,
                 from src/go.cpp:1:
src/error.h:1:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=ifndef ERROR_H
 ^
src/error.h:2:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=define ERROR_H
 ^
src/error.h:13:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=endif /* ERROR_H */
 ^
In file included from src/go.cpp:1:0:
src/go.h:8:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include "goban.h"
 ^
In file included from src/go.h:8:0,
                 from src/go.cpp:1:
src/goban.h:9:2: warning: trigraph ??= converted to # [-Wtrigraphs]
  ??=ifndef GOBAN_H
 ^
src/goban.h:10:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=define GOBAN_H
 ^
src/goban.h:12:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include <cstdarg>
 ^
In file included from src/go.h:8:0,
                 from src/go.cpp:1:
src/goban.h:13:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include <cassert>
 ^
In file included from src/go.h:8:0,
                 from src/go.cpp:1:
src/goban.h:14:1: warning: trigraph ??= converted to # [-Wtrigraphs]
 ??=include <sstream>
 ^
In file included from src/go.cpp:1:0:

In file included from src/go.h:8:0,
                 from src/go.cpp:1:
src/goban.h:14:0: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make: *** [build/go.o] Error 1

Comment 4 Jason Merrill 2014-02-24 18:09:02 UTC
It's tripping this assert:

      /* MAP must be an ordinary map and LOC must be non-virtual,                                              
         encoded into this map, obviously; the accessors used on MAP                                           
         below ensure it is ordinary.  Let's just assert the                                                   
         non-virtualness of LOC here.  */
      if (linemap_location_from_macro_expansion_p (set, loc))
=>      abort ();

Comment 5 Jakub Jelinek 2014-03-03 11:16:13 UTC
Tracking this now upstream as http://gcc.gnu.org/PR60400 .


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