Bug in GCC -- seg fault initialization

Bug in GCC -- seg fault initialization

Post by Nick Kralevi » Wed, 31 Jul 1996 04:00:00



Can someone tell me what this is suppose to accomplish and
why it causes a GCC seg fault.  I pulled this code from a program
I was trying to compile under Linux

----- Begin -----
#define CREAD 1
#define CLOCAL 2
#define CS8 3
#define NCCS 10
#define B2400 12
#define NULL 0
#define QUEUE_SIZE 50

/*
 * Actual UPS pre-initialized handler with reasonable defaults.
 * The initialization is *very* GNU CC specific.  Sigh.
 */

static struct ups ups = {
        NULL,                                           /* model */
        {NULL, 0, {0, 0},                               /* port */
                {0, 0, 0, 0, {[0 ... NCCS-1] = 0},
                    0, 0},                              /* otty */
                {0, 0, CS8 | CREAD | CLOCAL,
                    0, {[0 ... NCCS-1] = 0},
                    B2400, B2400},                      /* ntty */
                1, {0, 0},                              /* block size and delay */
                {QUEUE_SIZE, NULL, NULL, NULL}},        /* queue */

         NULL                                           /* events */

Quote:};

----- End -----

Script started on Mon Jul 29 20:48:13 1996
bmw:~/upsd-2.0> gcc -O -I../include -Wall -c uspd.new.c
uspd.new.c:16: variable `ups' has initializer but incomplete type
uspd.new.c:17: warning: excess elements in struct initializer after `ups'
uspd.new.c:18: extra brace group at end of initializer for `ups'
uspd.new.c:18: extra brace group at end of initializer for `ups'
uspd.new.c:19: extra brace group at end of initializer for `ups'
uspd.new.c:19: extra brace group at end of initializer for `ups'
gcc: Internal compiler error: program cc1 got fatal signal 11
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bmw:~/upsd-2.0> gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2/specs
gcc version 2.7.2
bmw:~/upsd-2.0> uname -a
Linux bmw.autobahn.org 2.0.10 #4 Mon Jul 29 16:06:58 PDT 1996 i586
bmw:~/upsd-2.0> exit
exit

Script done on Mon Jul 29 20:48:31 1996

Take care,
-- Nick Kralevich

 
 
 

Bug in GCC -- seg fault initialization

Post by Lawrence Kirb » Thu, 01 Aug 1996 04:00:00




Quote:>Can someone tell me what this is suppose to accomplish and
>why it causes a GCC seg fault.  I pulled this code from a program
>I was trying to compile under Linux

>----- Begin -----
>#define CREAD 1
>#define CLOCAL 2
>#define CS8 3
>#define NCCS 10
>#define B2400 12
>#define NULL 0
>#define QUEUE_SIZE 50

>/*
> * Actual UPS pre-initialized handler with reasonable defaults.
> * The initialization is *very* GNU CC specific.  Sigh.
> */

>static struct ups ups = {
>        NULL,                                           /* model */
>        {NULL, 0, {0, 0},                               /* port */
>                {0, 0, 0, 0, {[0 ... NCCS-1] = 0},
>                    0, 0},                              /* otty */
>                {0, 0, CS8 | CREAD | CLOCAL,
>                    0, {[0 ... NCCS-1] = 0},
>                    B2400, B2400},                      /* ntty */
>                1, {0, 0},                              /* block size and delay
> */
>                {QUEUE_SIZE, NULL, NULL, NULL}},        /* queue */

>         NULL                                           /* events */
>};
>----- End -----

>Script started on Mon Jul 29 20:48:13 1996
>bmw:~/upsd-2.0> gcc -O -I../include -Wall -c uspd.new.c
>uspd.new.c:16: variable `ups' has initializer but incomplete type

gcc is telling you that you are trying to initialise a structure whose
members you haven't defined. From the limited code sample you supply
I have no reason to disagree with it!

Quote:>uspd.new.c:17: warning: excess elements in struct initializer after `ups'
>uspd.new.c:18: extra brace group at end of initializer for `ups'
>uspd.new.c:18: extra brace group at end of initializer for `ups'
>uspd.new.c:19: extra brace group at end of initializer for `ups'
>uspd.new.c:19: extra brace group at end of initializer for `ups'
>gcc: Internal compiler error: program cc1 got fatal signal 11
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

gcc has issued the required diagnostic. It can do what it likes after that!

--
-----------------------------------------


-----------------------------------------

 
 
 

Bug in GCC -- seg fault initialization

Post by Joe Bu » Sat, 03 Aug 1996 04:00:00



>>Can someone tell me what this is suppose to accomplish and
>>why it causes a GCC seg fault.  I pulled this code from a program
>>I was trying to compile under Linux

[ program deleted ]

>>uspd.new.c:17: warning: excess elements in struct initializer after `ups'
>>uspd.new.c:18: extra brace group at end of initializer for `ups'
>>uspd.new.c:18: extra brace group at end of initializer for `ups'
>>uspd.new.c:19: extra brace group at end of initializer for `ups'
>>uspd.new.c:19: extra brace group at end of initializer for `ups'
>>gcc: Internal compiler error: program cc1 got fatal signal 11
>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>gcc has issued the required diagnostic. It can do what it likes after that!

No, gcc dumped core.  That's not acceptable behavior.

From the gcc manual:

----------------------------------------------------------------------
Have You Found a Bug?
=====================

   If you are not sure whether you have found a bug, here are some
guidelines:

   * If the compiler gets a fatal signal, for any input whatever, that
     is a compiler bug.  Reliable compilers never crash.
----------------------------------------------------------------------

(Modulo crappy PC hardware or memory, I should add, since this sometimes
produces random gcc crashes).


information so the maintainers can reproduce the bug.
--

Work for something because it is good,
not just because it stands a chance to succeed.    -- Vaclav Havel

 
 
 

1. Seg Faults with gcc 2.8.1 !!

I run RedHat 5.0 and I just got gcc 2.8.1, because I couldn't compile
anything large with the old 2.7.2.2 that I had.  I compiled my kernel
(2.0.33) with this version of gcc.  Now, when I run isapnp, or X, I get
a seg fault, and a core file.  (I hate core files.)

Is this a problem with gcc?  Should I upgrade libc, too?  I seem to have
version 2.0.7.

--

Kertis Henderson

2. 100MB to 10MB

3. Intermittent seg faults - elf, xview or gcc (or all three)

4. pointer focus in fvwm2-95?

5. seg faults when compiling gcc with -pipe

6. Printing to Eltron label printer

7. suddenly Seg Faults on exit of gcc-compiled bins, and on gnu Make's

8. HOWTO: activate kernel NFS server?

9. Change from gcc to egcs gives seg fault in make

10. help!! seg fault with gcc

11. gcc Error 139 or Seg fault (glibc2.0.7)

12. [Fwd: gcc seg fault when not casting pointers properly ???]

13. gcc-2.7.2 seg faults