public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/59613] New: Incorrect code generation in MSP430 large model
@ 2013-12-27 22:09 l.marcantonio at logossrl dot com
  2013-12-30 17:38 ` [Bug target/59613] " nickc at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: l.marcantonio at logossrl dot com @ 2013-12-27 22:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59613

            Bug ID: 59613
           Summary: Incorrect code generation in MSP430 large model
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: l.marcantonio at logossrl dot com

Found on 4.9.0 fresh from trunk (svn 206223); it's actually a showstopper for
large model since it miscompiles crtbegin.o (frame_dummy(), for example).
However I found a minimal sample which gives the problem  (it's a function
pointer instead of a weak symbol but the problem is the same).

Code generation (or optimization) is broken for MSP430 in large model; given
this simple code:

/*****/
extern void (*unk_function)(void);

void do_stuff(void)
{
    if (unk_function)
        unk_function();
}
/*****/

Compiling in standard mode with 

msp430-elf-gcc -mmcu=msp430x -Wall -S -O2 test.c

gives the following assembly (which is quite adequate)

.text
        .balign 2
        .global do_stuff
do_stuff:
; start of function
; framesize_regs:     0
; framesize_locals:   0
; framesize_outgoing: 0
; framesize:          0
; elim ap -> fp       2
; elim fp -> sp       0
; saved regs:(none)
        ; start of prologue
        ; end of prologue
        MOV.W   &unk_function, R12
        CMP.W   #0, R12 { JEQ   .L1
        CALL    R12
.L1:
        ; start of epilogue
        RET

However in large model (adding -mlarge to the above command line) the result is

.text
        .balign 2
        .global do_stuff
do_stuff:
; start of function
; framesize_regs:     0
; framesize_locals:   0
; framesize_outgoing: 0
; framesize:          0
; elim ap -> fp       4
; elim fp -> sp       0
; saved regs:(none)
        ; start of prologue
        ; end of prologue
        CALLA   &unk_function
        ; start of epilogue
        RETA

The condition checking is not done, and a crash follows. Using -O0 or -Os
doesn't change the behaviour. Looking in the RTL with -fdump-final-insns shows
a NOTE_INSN_DELETED instead of the condition check but I'm not proficient to
interpretate that...


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

* [Bug target/59613] Incorrect code generation in MSP430 large model
  2013-12-27 22:09 [Bug target/59613] New: Incorrect code generation in MSP430 large model l.marcantonio at logossrl dot com
@ 2013-12-30 17:38 ` nickc at gcc dot gnu.org
  2013-12-30 17:40 ` nickc at gcc dot gnu.org
  2014-01-08 10:02 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: nickc at gcc dot gnu.org @ 2013-12-30 17:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59613

Nick Clifton <nickc at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pab at pabigot dot com

--- Comment #1 from Nick Clifton <nickc at gcc dot gnu.org> ---
*** Bug 52856 has been marked as a duplicate of this bug. ***


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

* [Bug target/59613] Incorrect code generation in MSP430 large model
  2013-12-27 22:09 [Bug target/59613] New: Incorrect code generation in MSP430 large model l.marcantonio at logossrl dot com
  2013-12-30 17:38 ` [Bug target/59613] " nickc at gcc dot gnu.org
@ 2013-12-30 17:40 ` nickc at gcc dot gnu.org
  2014-01-08 10:02 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: nickc at gcc dot gnu.org @ 2013-12-30 17:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59613

Nick Clifton <nickc at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |nickc at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #2 from Nick Clifton <nickc at gcc dot gnu.org> ---
This is a bug in the generic gcc code - get_mode_bounds() to be precise.  It
has now been fixed by this patch:

http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01950.html

Cheers
  Nick


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

* [Bug target/59613] Incorrect code generation in MSP430 large model
  2013-12-27 22:09 [Bug target/59613] New: Incorrect code generation in MSP430 large model l.marcantonio at logossrl dot com
  2013-12-30 17:38 ` [Bug target/59613] " nickc at gcc dot gnu.org
  2013-12-30 17:40 ` nickc at gcc dot gnu.org
@ 2014-01-08 10:02 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-08 10:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59613

Bug 59613 depends on bug 59649, which changed state.

Bug 59649 Summary: [4.9 regression] BImode miscompiled
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED


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

end of thread, other threads:[~2014-01-08 10:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-27 22:09 [Bug target/59613] New: Incorrect code generation in MSP430 large model l.marcantonio at logossrl dot com
2013-12-30 17:38 ` [Bug target/59613] " nickc at gcc dot gnu.org
2013-12-30 17:40 ` nickc at gcc dot gnu.org
2014-01-08 10:02 ` jakub 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).