[coreboot] romcc segfault

Stefan Reinauer stefan.reinauer at coreboot.org
Tue Apr 12 23:10:12 CEST 2011


Hi,

just a heads up, I got romcc to segfault with the following sample program:


--------------------- 8< snip 8< --------------------------------------
typedef unsigned int u32;
#define DEFAULT_RCBA 0xfed1c000
#define GCS 0x3410
#define RCBA32(x) *((volatile u32 *)(DEFAULT_RCBA + x))

void test(void)
{
        RCBA32(GCS) &= (~0x04);
}
--------------------- >8 snip >8 --------------------------------------

I tried to simplify this further and this construct is still crashing romcc:

--------------------- 8< snip 8< --------------------------------------
        u32 *gcs = (u32 *)(DEFAULT_RCBA + GCS);
        *gcs &= (~0x04);
--------------------- >8 snip >8 --------------------------------------

while this one is working

--------------------- 8< snip 8< --------------------------------------
        u32 *gcs = (u32 *)(DEFAULT_RCBA + GCS);
        u32 temp = *gcs;
        temp &= (~0x04);
        *gcs = temp;
--------------------- >8 snip >8 --------------------------------------

Is that a construct that we just can't/don't want to support in romcc?
Or is there a chance we can fix that?

Stefan



gdb back trace:

$ gdb build/util/romcc/romcc 
GNU gdb (GDB) 7.2-gg8
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
Type "show copying" and "show warranty" for licensing/warranty details.
This GDB was configured as "x86_64-linux".

<http://wiki/Main/GnuDebugger  FAQ: http://go/gdb  Email: gdb-team>
Hey, I'm GDB 7.x.  Check me out!  http://wiki/Main/Gdb7x

Reading symbols from /Users/stepan/svn/coreboot/build/util/romcc/romcc...done.
(gdb) run test.c
Starting program: /Users/stepan/svn/coreboot/build/util/romcc/romcc test.c

Program received signal SIGSEGV, Segmentation fault.
0x0000000000402baa in use_triple (used=0x676860, user=0x676a50) at
/Users/stepan/svn/coreboot/util/romcc/romcc.c:1901
1901                    if ((*ptr)->member == user) {
(gdb) bt
#0  0x0000000000402baa in use_triple (used=0x676860, user=0x676a50) at
/Users/stepan/svn/coreboot/util/romcc/romcc.c:1901
#1  0x00000000004120df in flatten_generic (state=0x7fffffff9c60, first=0x675d40, ptr=0x676a50, ignored=0)
    at /Users/stepan/svn/coreboot/util/romcc/romcc.c:7847
#2  0x00000000004131a0 in flatten (state=0x7fffffff9c60, first=0x675d40, ptr=0x676a50) at
/Users/stepan/svn/coreboot/util/romcc/romcc.c:8042
#3  0x000000000041e1fb in expr_statement (state=0x7fffffff9c60, first=0x675d40) at
/Users/stepan/svn/coreboot/util/romcc/romcc.c:11662
#4  0x0000000000420479 in statement (state=0x7fffffff9c60, first=0x675d40) at
/Users/stepan/svn/coreboot/util/romcc/romcc.c:12361
#5  0x0000000000420248 in compound_statement (state=0x7fffffff9c60, first=0x675d40) at
/Users/stepan/svn/coreboot/util/romcc/romcc.c:12304
#6  0x0000000000422bb1 in function_definition (state=0x7fffffff9c60, type=0x675c60) at
/Users/stepan/svn/coreboot/util/romcc/romcc.c:13415
#7  0x0000000000422fa5 in decl (state=0x7fffffff9c60, first=0x675960) at
/Users/stepan/svn/coreboot/util/romcc/romcc.c:13507
#8  0x00000000004231b8 in decls (state=0x7fffffff9c60) at /Users/stepan/svn/coreboot/util/romcc/romcc.c:13553
#9  0x000000000043f263 in compile (filename=0x7fffffffe389 "test.c", compiler=0x7fffffffdea0, arch=0x7fffffffdf00)
    at /Users/stepan/svn/coreboot/util/romcc/romcc.c:25045
#10 0x000000000043f98b in main (argc=1, argv=0x7fffffffe020) at
/Users/stepan/svn/coreboot/util/romcc/romcc.c:25190






More information about the coreboot mailing list