[Bug c/67316] New: Address local variable returned as 0x0
llandwerlin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Aug 22 00:32:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67316
Bug ID: 67316
Summary: Address local variable returned as 0x0
Product: gcc
Version: 5.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: llandwerlin at gmail dot com
Target Milestone: ---
Playing with a project using Hans Boehm's GC (http://www.hboehm.info/gc/), and
getting a crash with gcc 5.2.1, I nailed down the difference to the following
program :
----------------------------------
#include <stdio.h>
typedef char* ptr_t;
typedef unsigned long word;
ptr_t GC_approx_sp1(void)
{
volatile word dummy;
dummy = 42;
return((ptr_t)&dummy);
}
ptr_t GC_approx_sp2(void)
{
volatile word dummy;
dummy = 42;
ptr_t ret = (ptr_t)&dummy;
return ret;
}
int
main(int argc, char* argv[]) {
printf("sp1=%p, sp2=%p\n", GC_approx_sp1(), GC_approx_sp2());
return 0;
}
----------------------------------
GCC 4.8/4.9 will print something like this : sp1=0x7ffc8fa4ce98,
sp2=0x7ffc8fa4ce90
GCC 5.2.1 will print this : sp1=(nil), sp2=0x7ffcb650d550
I may be missing something obvious here, but if this is a programming error, I
find it weird this thing never got caught before.
For info the function from hboehm's GC is GC_approx_sp().
Thanks!
More information about the Gcc-bugs
mailing list