LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 947 - llvm-gcc4 doesn't support GCC address of label extension
Summary: llvm-gcc4 doesn't support GCC address of label extension
Status: RESOLVED FIXED
Alias: None
Product: tools
Classification: Unclassified
Component: llvm-gcc (show other bugs)
Version: 1.7
Hardware: All All
: P normal
Assignee: Chris Lattner
URL:
Keywords: missing-feature
Depends on:
Blocks: 498 1166
  Show dependency tree
 
Reported: 2006-10-15 18:33 PDT by Nick Lewycky
Modified: 2010-02-22 12:44 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments
Testcase from gcc.c-torture (164 bytes, text/plain)
2007-02-04 15:04 PST, Anton Korobeynikov
Details
Another testcase from gcc.c-torture (124 bytes, text/plain)
2007-02-04 15:05 PST, Anton Korobeynikov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Lewycky 2006-10-15 18:33:59 PDT
Taking the address of a label doesn't seem to be supported in llvm-gcc4. This
GCC extension is described in
http://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/Labels-as-Values.html . This is the
program:

  void foo() {
    void *ptr;
  label:
    ptr = &&label;
  }

$ llvm-gcc gotolabel.c
Unhandled lvalue expression!
 <label_decl 0x55a6fd98 label
    type <void_type 0x55a26708 void sizes-gimplified VOID
        align 8 symtab 145740416 alias set -1
        pointer_to_this <pointer_type 0x55a26780>>
    side-effects used asm-frame-size 0 VOID file gotolabel.c line 4
    align 1 context <function_decl 0x55a6fb40 foo> initial <error_mark 0x55a172d8>
    LLVM: label %label>
gotolabel.c: In function ‘foo’:
gotolabel.c:1: internal compiler error: in EmitLV, at llvm-convert.cpp:604
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://llvm.org/bugs> for instructions.

Here's a backtrace:

#0  internal_error (gmsgid=0x890e091 "in %s, at %s:%d")
    at ../../src/gcc/diagnostic.c:532
#1  0x08166d7f in fancy_abort (
    file=0x8953e40 "../../src/gcc/llvm-convert.cpp", line=604, 
    function=0x895eec9 "EmitLV") at ../../src/gcc/diagnostic.c:588
#2  0x0832269b in TreeToLLVM::EmitLV (this=0xffffaee4, exp=0x55a6fd98)
    at ../../src/gcc/llvm-convert.cpp:604
#3  0x083242aa in TreeToLLVM::EmitADDR_EXPR (this=0xffffaee4, exp=0x55a1c230)
    at ../../src/gcc/llvm-convert.cpp:1718
#4  0x0832223d in TreeToLLVM::Emit (this=0xffffaee4, exp=0x55a1c230, 
    DestLoc=0x0) at ../../src/gcc/llvm-convert.cpp:513
#5  0x0833c94b in TreeToLLVM::EmitMODIFY_EXPR (this=0xffffaee4, 
    exp=0x55a1c258, DestLoc=0x0) at ../../src/gcc/llvm-convert.cpp:2055
#6  0x0832210d in TreeToLLVM::Emit (this=0xffffaee4, exp=0x55a1c258, 
    DestLoc=0x0) at ../../src/gcc/llvm-convert.cpp:515
#7  0x0833add3 in TreeToLLVM::EmitSTATEMENT_LIST (this=0xffffaee4, 
    exp=0x55a77690, DestLoc=0x0) at ../../src/gcc/llvm-convert.cpp:1168
#8  0x08322163 in TreeToLLVM::Emit (this=0xffffaee4, exp=0x55a77690, 
    DestLoc=0x0) at ../../src/gcc/llvm-convert.cpp:488
#9  0x0833b948 in TreeToLLVM::EmitBIND_EXPR (this=0xffffaee4, exp=0x55a71068, 
    DestLoc=0x0) at ../../src/gcc/llvm-convert.cpp:1143
#10 0x083220e0 in TreeToLLVM::Emit (this=0xffffaee4, exp=0x55a71068, 
    DestLoc=0x0) at ../../src/gcc/llvm-convert.cpp:487
#11 0x0830e0d3 in llvm_emit_code_for_current_function (fndecl=0x55a6fb40)
    at ../../src/gcc/llvm-backend.cpp:412
#12 0x080dc8bf in tree_rest_of_compilation (fndecl=0x55a6fb40)
    at ../../src/gcc/tree-optimize.c:704
#13 0x0805e3a3 in c_expand_body (fndecl=0x55a6fb40)
    at ../../src/gcc/c-decl.c:6954
#14 0x083819ad in cgraph_expand_function (node=0x55a6fe10)
    at ../../src/gcc/cgraphunit.c:896
#15 0x08381b65 in cgraph_assemble_pending_functions ()
    at ../../src/gcc/cgraphunit.c:313
#16 0x08384165 in cgraph_finalize_function (decl=0x55a6fb40, nested=false)
    at ../../src/gcc/cgraphunit.c:411
#17 0x0805e965 in finish_function () at ../../src/gcc/c-decl.c:6923
#18 0x08054808 in yyparse () at c-parse.y:440
#19 0x080557eb in c_parse_file () at c-parse.y:3483
#20 0x080a5c7a in c_common_parse_file (set_yydebug=0)
    at ../../src/gcc/c-opts.c:1238
#21 0x082e145a in toplev_main (argc=2, argv=0xffffbb34)
    at ../../src/gcc/toplev.c:1100
#22 0x080bb632 in main (argc=1634296879, argv=0x736f6e67)
    at ../../src/gcc/llvm-main.cpp:37
Comment 1 Reid Spencer 2006-11-02 19:07:08 PST
Is this something we're going to fix for 1.9 release? Its an extension and
implies new functionality.
Comment 2 Chris Lattner 2006-11-02 19:30:02 PST
not for 1.9
Comment 3 Anton Korobeynikov 2007-02-04 15:04:55 PST
Created attachment 620 [details]
Testcase from gcc.c-torture
Comment 4 Anton Korobeynikov 2007-02-04 15:05:18 PST
Created attachment 621 [details]
Another testcase from gcc.c-torture
Comment 5 Chris Lattner 2007-02-07 22:36:09 PST
Implemented.  Patches here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070205/044158.html

Testcase here: test/CFrontend/2007-02-07-AddrLabel.c

I verified that the other cases attached to this PR work as well.

-Chris