Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000062 [cparser] firm graph generation minor always 2010-11-25 09:10 2011-04-19 10:54
Reporter cas View Status public  
Assigned To zwinkau
Priority normal Resolution fixed  
Status closed   Product Version 0.9.10
Summary 0000062: Failure to completely initialize a struct for which fewer than all initializers are present
Description Given the following:

#include <stdio.h>

int main(void)
{
  char c[1];
  struct { char *c; unsigned i; } s = { c };

  printf("%p %x\n", (void *)c, s.i);

  return 0;
}

The value of s.i should be zero, but on my system I get this:
0xbfdf62e4 bfdf6314

I've included the address of the array simply to show how similar the values are; presumably the value of s.i is getting set to a stack address.

The lack of initialization of other members appears to happen when a pointer member is initialized. If I initialize the int only, the pointer is set to NULL as expected. This happens regardless of the order of the struct members.
Additional Information Linux 2.6.36.1
libfirm 1.18
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0000093)
zwinkau (manager)
2010-11-25 15:49
edited on: 2010-11-25 15:49

Confirmed. Fixed with r28158.

(0000095)
Matze (administrator)
2010-11-29 18:20

testcase in C/struct_init.c added, closing bug
(0000097)
Matze (administrator)
2010-11-29 19:06

the fix appears to break C/compoundlit3.c, reopening.
(0000098)
Matze (administrator)
2010-12-01 13:06

r28170 fixes C/compoundlit3.c again

- Issue History
Date Modified Username Field Change
2010-11-25 09:10 cas New Issue
2010-11-25 15:49 zwinkau Note Added: 0000093
2010-11-25 15:49 zwinkau Note Edited: 0000093
2010-11-25 16:26 UniQ Note Added: 0000094
2010-11-25 16:26 UniQ Status new => confirmed
2010-11-25 16:28 UniQ Note Deleted: 0000094
2010-11-29 18:20 Matze Note Added: 0000095
2010-11-29 18:20 Matze Assigned To => zwinkau
2010-11-29 18:20 Matze Status confirmed => resolved
2010-11-29 18:20 Matze Resolution open => fixed
2010-11-29 18:20 Matze Category unknown => firm graph generation
2010-11-29 19:06 Matze Note Added: 0000097
2010-11-29 19:06 Matze Status resolved => assigned
2010-11-29 19:06 Matze Resolution fixed => reopened
2010-12-01 13:06 Matze Note Added: 0000098
2010-12-01 13:06 Matze Status assigned => resolved
2010-12-01 13:06 Matze Resolution reopened => fixed
2011-04-19 10:54 Matze Status resolved => closed


Mantis 1.1.5[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker