[fixed in 4.5] "ICE: Segmentation fault" with precompiled header

Bug #541733 reported by Wang Danqi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-4.4 (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Binary package hint: gcc-4.4

Output of lsb_release -rd
 Description: Ubuntu 9.10 Release: 9.10

Output of apt-cache policy g++:
g++:
  Installed: 4:4.4.1-1ubuntu2
  Candidate: 4:4.4.1-1ubuntu2
  Version table:
 *** 4:4.4.1-1ubuntu2 0
        500 http://ftp.science.nus.edu.sg karmic/main Packages
        100 /var/lib/dpkg/status

Problem description:
When I try to compile my c++ code with g++, an "internal compiler error: Segmentation fault" occurs and g++ stops work.
The problem can be reproduced with a simple case with three c++ files, foo.cc foo.h and all.h. The content of these files are as follows:

all.h
#ifndef STDIO_H_
#define STDIO_H_
#include <stdio.h>
#endif /* STDIO_H_ */

foo.h
#include "all.h"

foo.cc
#include "foo.h"

Steps to produce the problem
1) g++ all.h to generate all.h.gch
2) g++ -c foo.cc Then the following error occurs:
c1plus: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.

If I remove all.h.gch and try step 2) again, everything goes fine.

If I change foo.h to the following content, then no error occurs.
foo.h
#include <math.h>
#include "all.h"

In addition, when I change foo.cc to foo.c and use gcc to repeat step 1) and 2), no error occurs.

Wang Danqi (beyondwdq)
description: updated
Revision history for this message
Matthias Klose (doko) wrote :

fixed in 4.5 (available as gcc-snapshot in lucid)

Changed in gcc-4.4 (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
summary: - g++ encounters "internal compiler error: Segmentation fault" with
- precompiled header
+ [fixed in 4.5] "ICE: Segmentation fault" with precompiled header
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.