https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67694

            Bug ID: 67694
           Summary: ICE on returning undefined enum in
                    must_pass_in_stack_var_size_or_pad
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: objc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: miyuki at gcc dot gnu.org
  Target Milestone: ---
            Target: x86_64-linux-gnu

$ cat test.m 
@interface F
@end
@implementation F
- (enum e) e { return E; };
@end

$ cc1obj test.m 
 -[F e]
test.m: In function '-[F e]':
test.m:4:9: internal compiler error: Segmentation fault
 - (enum e) e { return E; };
         ^
0xaf3ecf crash_signal
        /home/miyuki/gcc/src/gcc/toplev.c:353
0x730abf must_pass_in_stack_var_size_or_pad(machine_mode, tree_node const*)
        /home/miyuki/gcc/src/gcc/calls.c:5068
0xdeb2af ix86_must_pass_in_stack
        /home/miyuki/gcc/src/gcc/config/i386/i386.c:6301
0xdfb530 classify_argument
        /home/miyuki/gcc/src/gcc/config/i386/i386.c:6880
0xdfc8e9 examine_argument
        /home/miyuki/gcc/src/gcc/config/i386/i386.c:7274
0xe05065 ix86_return_in_memory
        /home/miyuki/gcc/src/gcc/config/i386/i386.c:8682
0x8963d5 aggregate_value_p(tree_node const*, tree_node const*)
        /home/miyuki/gcc/src/gcc/function.c:2089
0x89cf3e allocate_struct_function(tree_node*, bool)
        /home/miyuki/gcc/src/gcc/function.c:4989
0x6155af store_parm_decls()
        /home/miyuki/gcc/src/gcc/c/c-decl.c:8866
0x5c3716 objc_start_function(tree_node*, tree_node*, tree_node*, c_arg_info*)
        /home/miyuki/gcc/src/gcc/objc/objc-act.c:8630
0x5c7e89 really_start_method
        /home/miyuki/gcc/src/gcc/objc/objc-act.c:8683
0x5c946f start_method_def
        /home/miyuki/gcc/src/gcc/objc/objc-act.c:8398
0x5c946f objc_start_method_definition(bool, tree_node*, tree_node*, tree_node*)
        /home/miyuki/gcc/src/gcc/objc/objc-act.c:2073
0x668ff0 c_parser_objc_method_definition
        /home/miyuki/gcc/src/gcc/c/c-parser.c:8645
0x66f929 c_parser_translation_unit
        /home/miyuki/gcc/src/gcc/c/c-parser.c:1323
0x66f929 c_parse_file()
        /home/miyuki/gcc/src/gcc/c/c-parser.c:15509
0x6cb832 c_common_parse_file()
        /home/miyuki/gcc/src/gcc/c-family/c-opts.c:1058
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

I'm not sure, whether the problem is in the Objective C FE or somewhere in
ix86_return_in_memory target hook (and it's callees), but this ICE does not
occur when compiling for i?86:

$ cc1obj -m32 test.m
 -[F e]
test.m: In function '-[F e]':
test.m:4:23: error: 'E' undeclared (first use in this function)
 - (enum e) e { return E; };
                       ^
test.m:4:23: note: each undeclared identifier is reported only once for each
function it appears in

Reply via email to