public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/64010] New: [msp430-elf] struct function dereference clobbers parameter passed to function
@ 2014-11-21  3:08 amykyta3 at gmail dot com
  2014-12-02 16:34 ` [Bug rtl-optimization/64010] " nickc at redhat dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: amykyta3 at gmail dot com @ 2014-11-21  3:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64010
           Summary: [msp430-elf] struct function dereference clobbers
                    parameter passed to function
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amykyta3 at gmail dot com

Created attachment 34061
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34061&action=edit
msp430-elf src file

Using TI's prepackaged msp430-elf-gcc (version 4.9.1 20140707)
Also verified with most recent build (version 5.0.0 20141121)

When compiling with -O1 or higher, optimization is clobbering the 'dbe' struct
pointer in the snippet below:

--------------------------------------------------------------------
void param_to_string(char *dst_str, uint8_t dst_size, convert_entry_t *dbe){
    dbe->to_string(dst_str, dst_size, dbe);
}
--------------------------------------------------------------------

When dereferencing to_string, the original dbe is overwritten and passed into
the to_string function.
Resulting disassembly:

--------------------------------------------------------------------
void param_to_string(char *dst_str, uint8_t dst_size, convert_entry_t *dbe){
    dbe->to_string(dst_str, dst_size, dbe);
    459c:    1e 4e 02 00     mov    2(r14),    r14    ;

000045a0 <.LVL11>:
    45a0:    8e 12           call    r14        ;

000045a2 <.LVL12>:
}
    45a2:    30 41           ret
--------------------------------------------------------------------

Full src file included for more context


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-12-17 15:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-21  3:08 [Bug rtl-optimization/64010] New: [msp430-elf] struct function dereference clobbers parameter passed to function amykyta3 at gmail dot com
2014-12-02 16:34 ` [Bug rtl-optimization/64010] " nickc at redhat dot com
2014-12-02 17:45 ` uweigand at gcc dot gnu.org
2014-12-02 17:46 ` uweigand at gcc dot gnu.org
2014-12-03  0:20 ` pab at pabigot dot com
2014-12-03  0:31 ` pab at pabigot dot com
2014-12-03  3:25 ` amykyta3 at gmail dot com
2014-12-03 12:50 ` nickc at redhat dot com
2014-12-03 21:59 ` uweigand at gcc dot gnu.org
2014-12-03 22:07 ` uweigand at gcc dot gnu.org
2014-12-17 15:08 ` uweigand at gcc dot gnu.org
2014-12-17 15:09 ` uweigand at gcc dot gnu.org
2014-12-17 15:09 ` uweigand at gcc dot gnu.org

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).