https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71634
Bug ID: 71634 Summary: Invalid write with in mark_loops_for_removal (ira-build.c:2256) with --param ira-max-loops-num=0 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org Target Milestone: --- Hello. Following simple test-case produces invalid write of size 1B in: ==29696== Invalid write of size 1 ==29696== at 0xA05331: mark_loops_for_removal (ira-build.c:2256) ==29696== by 0xA05331: remove_unnecessary_regions(bool) (ira-build.c:2595) ==29696== by 0xA0838A: ira_build() (ira-build.c:3422) ==29696== by 0x9FEFA3: ira (ira.c:5220) ==29696== by 0x9FEFA3: (anonymous namespace)::pass_ira::execute(function*) (ira.c:5525) ==29696== by 0xAE0463: execute_one_pass(opt_pass*) (passes.c:2344) ==29696== by 0xAE0A37: execute_pass_list_1(opt_pass*) [clone .constprop.81] (passes.c:2428) ==29696== by 0xAE0A49: execute_pass_list_1(opt_pass*) [clone .constprop.81] (passes.c:2429) ==29696== by 0xAE0A94: execute_pass_list(function*, opt_pass*) (passes.c:2439) ==29696== by 0x7D4713: cgraph_node::expand() (cgraphunit.c:1983) ==29696== by 0x7D6000: expand_all_functions (cgraphunit.c:2119) ==29696== by 0x7D6000: symbol_table::compile() [clone .part.48] (cgraphunit.c:2475) ==29696== by 0x7D8427: compile (cgraphunit.c:2539) ==29696== by 0x7D8427: symbol_table::finalize_compilation_unit() (cgraphunit.c:2565) ==29696== by 0xBAAEB7: compile_file() (toplev.c:490) ==29696== by 0x63F4B3: do_compile (toplev.c:1998) ==29696== by 0x63F4B3: toplev::main(int, char**) (toplev.c:2132) ==29696== Address 0x40 is not stack'd, malloc'd or (recently) free'd $ valgrind --leak-check=yes --trac gcc -O3 --param ira-max-loops-num=0 tc.i $ cat tc.i fn1() {} I consider having min value of the parameter to zero does not make much sense and I'll send patch to mailing list. Martin