Bug 59731 - gcc Segmentation faults compiling a simple program
gcc Segmentation faults compiling a simple program
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.2
i586 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-02-12 03:16 EST by Mike McClintock
Modified: 2007-04-18 12:40 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-02 15:28:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mike McClintock 2002-02-12 03:16:19 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.78 [en] (X11; U; Linux 2.4.7-10 i586)

Description of problem:
gcc cores out when trying to compile simple C code.  The
Program below will compile, if the while statment is 
take out (you can leave the condition there).

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.put the following code in a .c file:
struct parce
{
    char	*next;
};

struct parse	*p;

void foo()
{
     while (*p->next)
	;
}

2. gcc <filenme>
	

Actual Results:  filename.c: In function foo:
filename.c:12: Internal error: Segmentation fault.
Please submut full bug report.
See <:http://bugzilla.redhat.com/bugzilla/> for instructions.

Additional info:

Note that this code has been simplified to make
finding the bug easier for you.

Also the code will compile if:
	while (*p->next)
is replace with
	*p->pnext;
Comment 1 Jakub Jelinek 2002-02-12 07:26:13 EST
Cannot reproduce this with either gcc-2.96-98 nor gcc3-3.0.1-3,
both on the exact example given above (with bad spelling) and after fixing
it so that it can actually compile.
What exact compiler version are you seeing this with and with what exact options?
Comment 2 Mike McClintock 2002-02-12 12:13:06 EST
I just bought the workstation verison of 
RedHat 7.2.
gcc -v shows me that it's version:
2.96 20000731 (Red Hat Linux 7.1.2.96.98)

I'm trying to compile Apache and got this
segment fault on the first file.  I reduced
the that file down the the .c above to make
it easy on you.
There are no options, just type:
gcc <.c filename>
That "while" statement is confusing it and causing 
gcc to throw the segmentation fault.
The file won't link, of course, but it's
not even getting near that stage.
If it works for you, which I expect it 
would or any C/C++ compiler, then I'm 
probably missing something in my installation,
like a shared library.  I'm hoping you've
seen similiar problems like this before and
can point me in the right direction, else I
won't be able to do develment work on this
machine.
Thanks
Comment 3 Jakub Jelinek 2002-02-12 12:40:29 EST
What I was wondering if you really were using parce (with c) once and parse
(with s) the other time.
But as I said, I cannot reproduce this in either case on two different
machines.
gcc uses no special libs, just libc, so no missing library could cause this.
Are you actually able to compile anything non-trivial on this box
(say kernel or some other project)?
Random gcc failures in 99.9% cases mean bad hardware (well, maybe more,
I haven't ever seen a non-reproduceable gcc failure which wasn't caused by
faulty hardware).
Comment 4 Mike McClintock 2002-02-12 13:01:49 EST
Would you mind if I gave you an account on my system
and let you telnet in?  I'll set up the test for you
and you can do what you want.  I just installed this
system, so there's nothing worth a hacker's time.

Comment 5 Mike McClintock 2002-02-12 13:36:48 EST
I can tell I'm lossing you.

Last question,
Can you give me a hint?
Memory?
Motherboard?
Disk?

X is running, the network is running ok too.
Everything seems to be running ok on this
bad hardware.
Comment 6 Need Real Name 2002-03-03 15:15:21 EST
I have the exact same problem when compiling the kernel on my Redhat 7.2 
system. It's a pure system - I have not installed any other software packages.

The segmentation fault occurs while compiling "floppy.c".

I'm quite sure it's not a hardware problem for the following reasons:

1) My system is *very* stable (have never been overclocked, everything within 
specs.)

2) I don't have problems with any other software.

3) The error occurs the exact same place every time I try to recompile the 
kernel. Hardware errors seem to occur on a semi-random basis, so it seems more 
like a software problem to me.

I've tried to find a solution in the errata section, but none of the fixes 
there seem to be related to this.
Comment 7 Need Real Name 2002-05-05 18:21:58 EDT
I too get seg faults when compiling the kernel with gcc (2.4.18 in my case) 
when I get to the make bzImage stage....

floppy.c: In function `format_interrupt':
floppy.c:2163: Internal error: Segmentation fault.

Same file, same function, same line # each time.  Hardware appears to be fine 
with everything else though. :(  Will attempt with kgcc and see what happens.
Comment 8 Dave Washburn 2002-10-11 01:23:04 EDT
 I am consistently getting the same segmentation fault error when compiling
ardour, an audio editing/mixing program.  Source code is at
http://ardour.sourceforge.net and is downloadable via cvs.  The error seems to
happen at various places; see the output of make below:
/root/ardour/libs/gtkmm/src/gtk--/label.h:74: internal error: Segmentation
   fault
----
And on the next run:
In file included from /root/ardour/libs/gtkmm/src/gtk--.h:96,
                 from /root/ardour/libs/gtkmmext/gtkmmext/gtk_ui.h:27,
                 from connection_editor.cc:21:
/root/ardour/libs/gtkmm/src/gtk--/eventbox.h:69: internal error: Segmentation
   fault
----
Next time:
/usr/include/c++/3.2/bits/stl_list.h: In member function `size_t std::list<_Tp,
   _Alloc>::size() const [with _Tp = LADSPA::Info*, _Alloc =
   std::allocator<LADSPA::Info*>]':
plugin_manager.cc:111:   instantiated from here
/usr/include/c++/3.2/bits/stl_list.h:401: internal error: Segmentation fault


This is on a working system, no bad hardware, just upgraded to RH 8.0 from 7.3.
Comment 9 Richard Henderson 2004-10-02 15:28:37 EDT
Closing as a compendium of unrelated non-reproducable segvs.

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