Bug 126053 - gcc crashes when run on the code fragment shown below.
gcc crashes when run on the code fragment shown below.
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
Blocks: FC3Target
  Show dependency treegraph
Reported: 2004-06-15 12:10 EDT by Anindya Basu
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-04 18:09:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Anindya Basu 2004-06-15 12:10:25 EDT
Description of problem:
gcc crashes with the following message:
gcc  -g -O2 -c eval.c -o eval.o
eval.c: In function `conv_literal':
eval.c:52: Internal compiler error in subst_stack_regs_pat, at reg-
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.

Version-Release number of selected component (if applicable):
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-112_MSDW_2)

How reproducible:

I am reproducing the code fragment that led to this. There is a parse 
error here, but gcc crashes instead.

typedef struct _Lit {
  double *col;		/* pointer to column */
  char col_name;	/* name of the column */
  int  offset;		/* row denoting offset of column */
} Lit;

/* access macros */
#define LIT_COL(e)	((e)->col)
#define LIT_NAME(e)	((e)->col_name)
#define LIT_OFF(e)	((e)->offset)

static inline int compute_row (int curr_row, int offset) {
  return curr_row + offset - START_ROW;

double conv_literal (int row, Lit *literal) 
  double val;

#if 0
  printf ("row %d\n", row);

  val = (LIT_COL(literal))[compute_row(row, LIT_OFF(literal))];

#if 1
  printf ("%c%d (%d) = %f\n", LIT_NAME (literal), LIT_OFF(literal), 
	  compute_row (row, LIT_OFF(literal)) + 2, val);

  return (val);

Steps to Reproduce:
1. gcc  -g -O2 -c eval.c -o eval.o
produces the error, where eval.c contains the code fragment.
Actual results:

Expected results:

Additional info:
Comment 1 Jakub Jelinek 2004-08-05 17:37:54 EDT
Fedora Core 3 doesn't include GCC 2.96-RH.
With gcc-2.96-128.7.2 (current AS2.1 compiler) I get:
gcc -g -O2 -S eval.c
eval.c: In function `compute_row':
eval.c:13: `START_ROW' undeclared (first use in this function)
eval.c:13: (Each undeclared identifier is reported only once
eval.c:13: for each function it appears in.)
eval.c: In function `conv_literal':
eval.c:29: confused by earlier errors, bailing out

If I add int START_ROW; to the beginning to get around this bug,
I get:
gcc -g -O2 -S eval.c
eval.c:32: parse error before `return'
Comment 2 Anindya Basu 2004-08-05 17:43:58 EDT

The bug seems to have disappeared now. I am unsure what happened 
then, but I was able to reproduce the bug multiple times, and yet it 
does not happen anymore. 

Sorry about the confusion.
Comment 3 Richard Henderson 2004-10-04 18:09:42 EDT
Bug evaporated.

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