public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20102] New: Incorrect floating point code generated when assigning to "packed" structure
@ 2005-02-20 17:21 oakad at yahoo dot com
  2005-02-20 18:50 ` [Bug target/20102] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: oakad at yahoo dot com @ 2005-02-20 17:21 UTC (permalink / raw)
  To: gcc-bugs

gcc generates incorrect code when assigning to stack residing struct 
bearing "packed" attribute. Correct code is generated when assigning to global 
struct of the same type.
Example:
//-----
typedef struct
{
  char x1;
  char x2;
  char x3;
  float v1;
  float v2;
  float v3;
  char x4;
  char x5;
} __attribute__((packed,aligned(1))) ptype1;

ptype1 g;

void foo()
{
//....
 ptype1 p;
//....
 p.v1=g.v1;
 p.v2=p.v3;
//....
}
//-----
When compiled with:
powerpc-eabi-gcc -std=gnu99 -mcpu=505 -fsingle-precision-constant -mmultiple -
mstring -fno-common -ffast-math -O3 -g3 -memb -msdata=eabi -G 26624
the following incorrect code is generated:
//---
lfs   f3, -31984(r13)  //g.v1
lfs   f2, 395(r1)      //p.v3 - incorrect misaligned load (throws exception)
stfs  f3, 387(r1)      //p.v1 - incorrect misaligned store (throws exception)
stfs  f2, 391(r1)      //p.v2 - incorrect misaligned store (throws exception)
//---
Desired behavior: at least error message; at most - consistent, byte by byte 
load/store.

-- 
           Summary: Incorrect floating point code generated when assigning
                    to "packed" structure
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oakad at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: powerpc-eabi-*


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


^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <bug-20102-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-12-22  0:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-20 17:21 [Bug c/20102] New: Incorrect floating point code generated when assigning to "packed" structure oakad at yahoo dot com
2005-02-20 18:50 ` [Bug target/20102] " pinskia at gcc dot gnu dot org
2005-02-20 19:44 ` pinskia at gcc dot gnu dot org
2005-02-21 10:47 ` oakad at yahoo dot com
2005-02-21 10:57 ` pinskia at gcc dot gnu dot org
2005-02-21 19:50 ` oakad at yahoo dot com
2005-08-23  1:31 ` amodra at bigpond dot net dot au
2005-08-23 10:40 ` oakad at yahoo dot com
2005-08-24  1:51 ` amodra at bigpond dot net dot au
2005-08-24  6:47 ` amodra at bigpond dot net dot au
2005-08-25  5:24 ` pinskia at gcc dot gnu dot org
     [not found] <bug-20102-4@http.gcc.gnu.org/bugzilla/>
2011-12-22  0:55 ` pinskia 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).