This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/39433] New: gcc core dumping for unnecessary header file conflict
- From: "nmdilipsimha at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Mar 2009 14:38:42 -0000
- Subject: [Bug c/39433] New: gcc core dumping for unnecessary header file conflict
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I created a small dummy program with a dedicated insignificant bug.
But gcc throws an error and then core dumps, which is abnormal.
Here is the output:
gcc -v -save-temps 1.c >& log.txt
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug
--enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
/usr/lib/gcc/i486-linux-gnu/4.1.3/cc1 -E -quiet -v 1.c -mtune=generic
-fpch-preprocess -o 1.i
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.1.3/include
/usr/include
End of search list.
/usr/lib/gcc/i486-linux-gnu/4.1.3/cc1 -fpreprocessed 1.i -quiet -dumpbase 1.c
-mtune=generic -auxbase 1 -version -fstack-protector -fstack-protector -o 1.s
GNU C version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
(i486-linux-gnu)
compiled by GNU C version 4.1.3 20070929 (prerelease) (Ubuntu
4.1.2-16ubuntu2).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=31866
Compiler executable checksum: caf034d6752b947185f431aa3e927159
In file included from 3.h:6,
from 2.h:6,
from 1.h:5,
from 1.c:2:
1.h:3: error: redefinition of typedef ?F1?
1.h:3: error: previous declaration of ?F1? was here
In file included from 3.h:6,
from 2.h:6,
from 1.h:5,
from 1.c:2:
1.h:9: error: field ?a2? has incomplete type
In file included from 1.c:2:
1.h:7: error: redefinition of ?struct f1?
gcc: Internal error: Segmentation fault (program cc1)
Please submit a full bug report.
Since test program is very small, I am pasting it here:
source files:
simha@home_pc:~/test/header_file$ cat 1.c
#include "1.h"
int main()
{
F1 a;
a.a = 1;
return 0;
}
---------------------------------------------
simha@home_pc:~/test/header_file$ cat 1.h
#ifndef F1_H
typedef struct f1 F1;
#include "2.h"
struct f1
{
int a;
F2 a2;
};
#define F1_H
#endif
---------------------------------------------
simha@home_pc:~/test/header_file$ cat 2.h
#ifndef F2_H
#define F2_H
typedef struct f2 F2;
#include "3.h"
struct f2
{
int a;
F3 a3;
};
#endif
---------------------------------------------
simha@home_pc:~/test/header_file$ cat 3.h
#ifndef F3_H
#define F3_H
typedef struct f3 F3;
#include "1.h"
struct f3
{
int a;
F1 a1;
};
#endif
---------------------------------------------
Finally 1.i:
simha@home_pc:~/test/header_file$ cat 1.i
# 1 "1.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "1.c"
# 1 "1.h" 1
typedef struct f1 F1;
# 1 "2.h" 1
typedef struct f2 F2;
# 1 "3.h" 1
typedef struct f3 F3;
# 1 "1.h" 1
typedef struct f1 F1;
# 1 "2.h" 1
# 5 "1.h" 2
struct f1
{
int a;
F2 a2;
};
# 6 "3.h" 2
struct f3
{
int a;
F1 a1;
};
# 6 "2.h" 2
struct f2
{
int a;
F3 a3;
};
# 5 "1.h" 2
struct f1
{
int a;
F2 a2;
};
# 2 "1.c" 2
int main()
{
F1 a;
a.a = 1;
return 0;
}
--
Summary: gcc core dumping for unnecessary header file conflict
Product: gcc
Version: 4.1.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nmdilipsimha at gmail dot com
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39433