public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3811] IPA: prevent an UBSAN error
@ 2020-10-12  9:09 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2020-10-12  9:09 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ab87b0add6a7c3464ee9067dd99e037e79f81984

commit r11-3811-gab87b0add6a7c3464ee9067dd99e037e79f81984
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Oct 12 10:13:46 2020 +0200

    IPA: prevent an UBSAN error
    
    Prevents the following UBSAN error:
    
    ./xgcc -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/torture/pr49770.C -O2 -c
    /home/marxin/Programming/gcc2/gcc/ipa-modref-tree.h:482:22: runtime error: load of value 2, which is not a valid value for type 'bool'
        #0 0x1fdb4d1 in modref_tree<int>::merge(modref_tree<int>*, vec<modref_parm_map, va_heap, vl_ptr>*) /home/marxin/Programming/gcc2/gcc/ipa-modref-tree.h:482
        #1 0x1fcadaa in merge_call_side_effects(modref_summary*, gimple*, modref_summary*, bool) /home/marxin/Programming/gcc2/gcc/ipa-modref.c:511
        #2 0x1fcbadd in analyze_call /home/marxin/Programming/gcc2/gcc/ipa-modref.c:642
        #3 0x1fcc061 in analyze_stmt /home/marxin/Programming/gcc2/gcc/ipa-modref.c:732
        #4 0x1fccf31 in analyze_function /home/marxin/Programming/gcc2/gcc/ipa-modref.c:823
        #5 0x1fd17e5 in execute /home/marxin/Programming/gcc2/gcc/ipa-modref.c:1441
        #6 0x25cca6e in execute_one_pass(opt_pass*) /home/marxin/Programming/gcc2/gcc/passes.c:2509
        #7 0x25cd39b in execute_pass_list_1 /home/marxin/Programming/gcc2/gcc/passes.c:2597
        #8 0x25cd450 in execute_pass_list_1 /home/marxin/Programming/gcc2/gcc/passes.c:2598
        #9 0x25cd4ee in execute_pass_list(function*, opt_pass*) /home/marxin/Programming/gcc2/gcc/passes.c:2608
        #10 0x25c7a5a in do_per_function_toporder(void (*)(function*, void*), void*) /home/marxin/Programming/gcc2/gcc/passes.c:1726
        #11 0x25cfa3f in execute_ipa_pass_list(opt_pass*) /home/marxin/Programming/gcc2/gcc/passes.c:2941
        #12 0x173572d in ipa_passes /home/marxin/Programming/gcc2/gcc/cgraphunit.c:2642
        #13 0x17364ee in symbol_table::compile() /home/marxin/Programming/gcc2/gcc/cgraphunit.c:2777
        #14 0x17372d9 in symbol_table::finalize_compilation_unit() /home/marxin/Programming/gcc2/gcc/cgraphunit.c:3022
        #15 0x2a1f00a in compile_file /home/marxin/Programming/gcc2/gcc/toplev.c:485
        #16 0x2a27dc8 in do_compile /home/marxin/Programming/gcc2/gcc/toplev.c:2321
        #17 0x2a283cc in toplev::main(int, char**) /home/marxin/Programming/gcc2/gcc/toplev.c:2460
        #18 0x54f21cd in main /home/marxin/Programming/gcc2/gcc/main.c:39
        #19 0x7ffff6f0de09 in __libc_start_main ../csu/libc-start.c:314
        #20 0x9eac09 in _start (/home/marxin/Programming/gcc2/objdir/gcc/cc1plus+0x9eac09)
    
    gcc/ChangeLog:
    
            * ipa-modref.c (merge_call_side_effects): Clear modref_parm_map
            fields in the vector.

Diff:
---
 gcc/ipa-modref.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index dd59e804c0f..b815eb8cc88 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -476,7 +476,7 @@ merge_call_side_effects (modref_summary *cur_summary,
   auto_vec <modref_parm_map, 32> parm_map;
   bool changed = false;
 
-  parm_map.safe_grow (gimple_call_num_args (stmt));
+  parm_map.safe_grow_cleared (gimple_call_num_args (stmt));
   for (unsigned i = 0; i < gimple_call_num_args (stmt); i++)
     {
       tree op = gimple_call_arg (stmt, i);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-12  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12  9:09 [gcc r11-3811] IPA: prevent an UBSAN error Martin Liska

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).