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

            Bug ID: 84945
           Summary: UBSAN: gcc/config/i386/i386.c:33312:22: runtime error:
                    shift exponent 32 is too large for 32-bit type 'int'
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
            Blocks: 63426
  Target Milestone: ---

Following causes an UBSAN:

$ cat tc.i
void a() {          __builtin_cpu_supports ("gfni"); }


$ ./xgcc -B. tc.i
../../gcc/config/i386/i386.c:33312:22: runtime error: shift exponent 32 is too
large for 32-bit type 'int'
    #0 0x2a7434e in fold_builtin_cpu ../../gcc/config/i386/i386.c:33312
    #1 0x2a76664 in ix86_fold_builtin ../../gcc/config/i386/i386.c:33334
    #2 0x10055ba in fold_build_call_array_loc(unsigned int, tree_node*,
tree_node*, int, tree_node**) ../../gcc/fold-const.c:12450
    #3 0x73a5b7 in build_function_call_vec(unsigned int, vec<unsigned int,
va_heap, vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*,
vec<tree_node*, va_gc, vl_embed>*) ../../gcc/c/c-typeck.c:3124
    #4 0x7b018f in c_parser_postfix_expression_after_primary
../../gcc/c/c-parser.c:9155
    #5 0x776898 in c_parser_postfix_expression ../../gcc/c/c-parser.c:8980
    #6 0x7998ca in c_parser_unary_expression ../../gcc/c/c-parser.c:7260
    #7 0x79c22a in c_parser_cast_expression ../../gcc/c/c-parser.c:7104
    #8 0x79ca1b in c_parser_binary_expression ../../gcc/c/c-parser.c:6907
    #9 0x79fe76 in c_parser_conditional_expression ../../gcc/c/c-parser.c:6645
    #10 0x7a108b in c_parser_expr_no_commas ../../gcc/c/c-parser.c:6562
    #11 0x7a15fe in c_parser_expression ../../gcc/c/c-parser.c:9292
    #12 0x7aad13 in c_parser_expression_conv ../../gcc/c/c-parser.c:9325
    #13 0x7d43f7 in c_parser_statement_after_labels ../../gcc/c/c-parser.c:5540
    #14 0x7dac3c in c_parser_compound_statement_nostart
../../gcc/c/c-parser.c:5078
    #15 0x7dc332 in c_parser_compound_statement ../../gcc/c/c-parser.c:4912
    #16 0x7df56e in c_parser_declaration_or_fndef ../../gcc/c/c-parser.c:2341
    #17 0x7f9e10 in c_parser_external_declaration ../../gcc/c/c-parser.c:1643
    #18 0x7fbd61 in c_parser_translation_unit ../../gcc/c/c-parser.c:1524
    #19 0x7fbd61 in c_parse_file() ../../gcc/c/c-parser.c:18411
    #20 0x8ebe43 in c_common_parse_file() ../../gcc/c-family/c-opts.c:1132
    #21 0x1d0fdfa in compile_file ../../gcc/toplev.c:455
    #22 0x639d9c in do_compile ../../gcc/toplev.c:2132
    #23 0x639d9c in toplev::main(int, char**) ../../gcc/toplev.c:2267
    #24 0x63c7fa in main ../../gcc/main.c:39
    #25 0x7ffff5cafa86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #26 0x63c929 in _start
(/home/marxin/Programming/gcc/objdir2/gcc/cc1+0x63c929)


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63426
[Bug 63426] [meta-bug] Issues found with -fsanitize=undefined

Reply via email to