Bug 67694 - ICE on returning undefined enum in must_pass_in_stack_var_size_or_pad
Summary: ICE on returning undefined enum in must_pass_in_stack_var_size_or_pad
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: objc (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2015-09-23 12:45 UTC by Mikhail Maltsev
Modified: 2021-07-29 17:15 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-07-29 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Maltsev 2015-09-23 12:45:30 UTC
$ 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
Comment 1 Martin Liška 2017-08-09 18:26:39 UTC
Confirmed for GCC 6 and 7.
Comment 2 Richard Biener 2019-04-03 09:20:45 UTC
*** Bug 89932 has been marked as a duplicate of this bug. ***
Comment 3 Andrew Pinski 2021-07-29 17:15:11 UTC
Related to PR 97882 but this one still happens.