[PR42611] Internal compiler error in tree.c

Bug #501921 reported by crazy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc
Fix Released
Medium
gcc-4.4 (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: gcc-4.4

OS: Ubuntu 9.10 Karmic Koala Linux version 2.6.31-16-generic (buildd@rothera) (gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8) ) #53-Ubuntu SMP Tue Dec 8 04:01:29 UTC 2009

GCC displays:
--------------------------------------------------------------------------------------------
demarcsek@alma:~/dev/secmem$ gcc secmem.c -Wall -o secmem
secmem.c: In function ‘main’:
secmem.c:42: warning: unused variable ‘x’
secmem.c:41: internal compiler error: in tree_low_cst, at tree.c:5014
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.
--------------------------------------------------------------------------------------------

after the attempt to compile the following .C file:
--------------------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <memory.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>

#define DEBUG_MODE 1

#define _DEBUG(str,param) { if( DEBUG_MODE == 1 ) { fprintf( stderr, "%s", "[DEBUG] " ); fprintf( stderr, str, param ); } }
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif

typedef char bool_t;

typedef struct struct_secmem_conf {
 int pagesize;
 bool_t crypt;
 int crypt_key;
 bool_t to_file;
 char dumpfile[ SSIZE_MAX ];
} secmem_conf;

void init_secmem( secmem_conf* d ) {
 if( d->pagesize == 0 )
  d->pagesize = sysconf( _SC_PAGESIZE );

 _DEBUG( "Configuration: pagesize set to: %d\n", d->pagesize );
}

int main( int argc, char* argv[] ) {
 secmem_conf x;
 return 0;
}
--------------------------------------------------------------------------------------------
So the line mentioned above in the error message (secmem.c:41) contains:
int main( int argc, char* argv[] ) {

I expected gcc to compile this file without errors. The strange part is that if I
comment out the following line:
secmem_conf x;
it worked well, furthermore, when I changed 'typedef struct struct_secmem_conf {' to simply
'typedef struct {' it worked as well and it had not had any problems with line 41. In my opinion,
gcc gets confused if it finds an identifier beginning with 'struct'. Maybe it mistakes it for the 'struct'
reserved word.

Finally, it could compile my code, but this can be an interesting point to check out.
Thank you,
Demarcsek György

Matthias Klose (doko)
Changed in gcc-4.4 (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Changed in gcc:
status: Unknown → New
Matthias Klose (doko)
summary: - Internal compiler error in tree.c
+ [PR42611] Internal compiler error in tree.c
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-4.4 - 4.4.2-8ubuntu2

---------------
gcc-4.4 (4.4.2-8ubuntu2) lucid; urgency=low

  * Update to SVN 20100105 from the gcc-4_4-branch (r155642).
    - Fixes PR tree-optimization/42337, PR target/42448, PR middle-end/42099,
      PR target/42549 (closes: #560812), PR tree-optimization/41956,
      PR target/42503, PR other/42611 (LP: #501921).
  * libgcj10: Move .so symlinks into gcj-4.4-jdk. Addresses: #563280.
  * Don't use expect-tcl8.3 on hppa anymore.
  * Merge gnat-4.4 changes back from 4.4.2-5.
  * Default to v9a (ultrasparc) on sparc*-linux.
  * gcj-4.4-jdk: Include /usr/lib/jvm-exports.
  * Use 4.4.3 as the upstream version (we'll end up with this version
    for the next release anyway).
 -- Matthias Klose <email address hidden> Tue, 05 Jan 2010 11:22:11 +0100

Changed in gcc-4.4 (Ubuntu):
status: Confirmed → Fix Released
Changed in gcc:
status: New → Fix Released
Changed in gcc:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.