🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #149

GCC 2.1 Bug/cc1 dumps core with -O

#149
From: Anton Hartl
Date: Mon, 06 Apr 1992 16:37
151 lines
4056 bytes
GCC 2.1 Bug Report

	cc1 dumps core when run with -O with the program below, i.e.
	    gcc -O -c tt.c 
	gives
	    gcc: Internal compiler error: program cc1 got fatal signal 11

	Wether cc1 is compiled with the systems C compiler /bin/cc,
	gcc 1.40 or with itself makes no difference.


Environment/Installation
	Sun Sparc, SunOS 4.1.1
	./configure sparc
	no special local modifications whatsoever


The gdb stack backtrace looks like that

Core was generated by `cc1'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libc.so.1.9...done.
#0  relax_delay_slots (first=0x185cf8) at reorg.c:3140
3140                  ++LABEL_NUSES (target_label);
(gdb) bt
#0  relax_delay_slots (first=0x185cf8) at reorg.c:3140
#1  0x11588c in dbr_schedule (first=0x185cf8, file=0x0) at reorg.c:3572
#2  0x2b89c in rest_of_compilation (decl=0x196938) at toplev.c:2377
#3  0x16980 in finish_function (nested=0) at c-decl.c:5586
#4  0x2bf8 in yyparse () at c-parse.y:257
#5  0x29730 in compile_file (name=0xf7fffaa2 "/usr/tmp/cca01359.i")
    at toplev.c:1607
#6  0x2d0d4 in main (argc=8, argv=0xf7fff9dc, envp=0xf7fffa00) at toplev.c:3012
(gdb)


Below I've append the smallest source file that reproduces the error.

Regards,
	Toni

_____________________________________________________________________________
_Anton Hartl___________________________Anton.Hartl@informatik.tu-muenchen.de_



#include <stdio.h>

typedef int     size_t;
typedef int     ERR_TYPE;

typedef struct
{
    ERR_TYPE        f_error;
} H_SYS_INFO;

typedef struct
{
    short           l, cb, ce;
} LINE_TYPE;

typedef struct
{
    long            num;
    LINE_TYPE       rl[(60000 * 2)];
} RL_TYPE;

typedef struct
{
    short           cl[30000], cc[30000];
    long            num;
} CONTOUR_TYPE;

typedef union
{
    long            l;
    float           f;
    char           *s;
} PAR_TYPE;

extern H_SYS_INFO HSysInfo;

ERR_TYPE 
HThickness(chord, dicke, histo, dicke_length, histo_length)
    RL_TYPE        *chord;
    PAR_TYPE        dicke[];
    PAR_TYPE        histo[];
    long           *histo_length, *dicke_length;
{
    double          l, c;
    long            i, num;
    long            x, y, maxx, minx;
    double          phi;
    double          b;
    double          cosphi, sinphi;
    RL_TYPE        *new;
    CONTOUR_TYPE   *cont;
    ERR_TYPE        HRLToCont();

    while (HRLSeg(new))
    {
	{
	    register ERR_TYPE ERR;
	    if ((ERR = HRLToCont(new, cont)) != 1)
		return (ERR);
	    if (HSysInfo.f_error != 1)
		return (HSysInfo.f_error);
	};
	sinphi = sin(phi);
	cosphi = cos(phi);
	x = c * cosphi - l * sinphi;
	b = -l * cosphi - c * sinphi;
	for (i = 0; i <= cont->num - 1; i++)
	{
	    y = -cont->cl[i] * cosphi - cont->cc[i] * sinphi - b;
	    x = cont->cc[i] * cosphi - cont->cl[i] * sinphi;
	    if (x < minx)
		minx = x;
	    if (x > maxx)
		maxx = x;
	    cont->cc[i] = (short) x;
	    cont->cl[i] = (short) y;
	}
	num = 0;
	x = minx;
	for (i = 0; i < 1024 * 2; i++)
	    histo[i].l = 0;
	i = 0;
	while (i < num)
	{
	    histo[(dicke[i].l)].l += 1;
	    i++;
	}
	i = 1024 * 2 - 1;
	while (!histo[i--].l) ;
	i += 2;
    }
    {
	register ERR_TYPE ERR;
	if ((ERR = HFreeTmp((char *) cont)) != 1)
	    return (ERR);
    };
    {
	register ERR_TYPE ERR;
	if ((ERR = HFreeRL(new)) != 1)
	    return (ERR);
	if (HSysInfo.f_error != 1)
	    return (HSysInfo.f_error);
    };
    return (1);
}
Technical Details
Message-ID: <92Apr6.133731met_dst.167939@dsrbg2.informatik.tu-muenchen.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!informatik.tu-muenchen.DE!hartl

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!informatik.tu-muenchen.DE!hartl
From: hartl@informatik.tu-muenchen.DE (Anton Hartl)
Subject: GCC 2.1 Bug/cc1 dumps core with -O
Message-ID: <92Apr6.133731met_dst.167939@dsrbg2.informatik.tu-muenchen.de>
Sender: gnulists@ai.mit.edu
Reply-To: hartl@informatik.tu-muenchen.de
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 6 Apr 1992 16:37:15 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 152