[Bug rtl-optimization/25636] [4.2 Regression] opts.c is being miscompiled, write to read only memory
drab at kepler dot fjfi dot cvut dot cz
gcc-bugzilla@gcc.gnu.org
Mon Jan 16 03:33:00 GMT 2006
------- Comment #23 from drab at kepler dot fjfi dot cvut dot cz 2006-01-16 03:33 -------
(In reply to comment #20)
> (In reply to comment #18)
> > (In reply to comment #17)
> > > Yes, it is unnecessary, but not wrong, since if you take a closer look, it is
> > > just
> >
> > Actually it is wrong as it is in read only memory.
> >
> > (insn:TI 412 535 40 ../../gcc/opts.c:1301 (set (mem/u/c/i:SI (symbol_ref:SI
> > ("cl_options_count") [flags 0x40] <var_decl 0xb7bd8160 cl_options_count>) [3
> > cl_options_count+0 S4 A32])
> > (reg:SI 3 bx [orig:143 cl_options_count ] [143])) 34 {*movsi_1} (nil)
> > (expr_list:REG_EQUIV (mem/u/c/i:SI (symbol_ref:SI ("cl_options_count")
> > [flags 0x40] <var_decl 0xb7bd8160 cl_options_count>) [3 cl_options_count+0 S4
> > A32])
> > (nil)))
>
> I assume this means "read-only" just as a hint for the compiler, right? Not
> that it would really actually reside in a "read-only" memory. So the writing
> should not cause the segfault. It is the memset that causes the segfault, no?
Well, OK, looking at freddy's back trace:
Program received signal SIGSEGV, Segmentation fault.
0x083580bd in print_filtered_help (flag=536870912) at ../.././gcc/opts.c:1301
1301 memset (printed, 0, cl_options_count);
(gdb) bt
#0 0x083580bd in print_filtered_help (flag=536870912) at
../.././gcc/opts.c:1301
#1 0x08358f53 in decode_options (argc=2, argv=0xbf830644) at
../.././gcc/opts.c:1250
#2 0x083bf9b0 in toplev_main (argc=2, argv=0xbf830644) at
../.././gcc/toplev.c:1974
#3 0x080b8e6f in main (argc=0, argv=0x259) at ../.././gcc/main.c:35
it really looks as that writing, but I still didn't figure out where is the
third argument of the memset. Do you see it set somewhere?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25636
More information about the Gcc-bugs
mailing list