Bug 126053 - gcc crashes when run on the code fragment shown below.
Summary: gcc crashes when run on the code fragment shown below.
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: FC3Target
TreeView+ depends on / blocked
 
Reported: 2004-06-15 16:10 UTC by Anindya Basu
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-04 22:09:42 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Anindya Basu 2004-06-15 16:10:25 UTC
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-
stack.c:1414
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:
Always. 

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);
#endif

  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);
  }
#endif

  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 21:37:54 UTC
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 21:43:58 UTC
Interesting.

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.
-Anindya

Comment 3 Richard Henderson 2004-10-04 22:09:42 UTC
Bug evaporated.


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