public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/65476] New: Long_Float array does not byte swap correctly when set to Scalar_Storage_Order with High Order First
@ 2015-03-19 22:11 daniel.merrill at psware dot com
  2015-04-29 10:50 ` [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order ebotcazou at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: daniel.merrill at psware dot com @ 2015-03-19 22:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65476
           Summary: Long_Float array does not byte swap correctly when set
                    to Scalar_Storage_Order with High Order First
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel.merrill at psware dot com
                CC: ebotcazou at gcc dot gnu.org

Created attachment 35067
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35067&action=edit
code to reproduce the issue.

When an array of Long_Floats is set to a scalar_storage_order of
High_Order_First, only the two 32 bit words that make up the 64 bit value are
swapped with each other but the bytes under those words are not swapped
properly. Attached is a simple program that reproduces the behavior. If you
examine the stored values you could get the right value by performing a byte
swap on the underlying 32 bit value.


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

* [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order
  2015-03-19 22:11 [Bug ada/65476] New: Long_Float array does not byte swap correctly when set to Scalar_Storage_Order with High Order First daniel.merrill at psware dot com
@ 2015-04-29 10:50 ` ebotcazou at gcc dot gnu.org
  2015-04-29 11:15 ` ebotcazou at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-04-29 10:50 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixing.


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

* [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order
  2015-03-19 22:11 [Bug ada/65476] New: Long_Float array does not byte swap correctly when set to Scalar_Storage_Order with High Order First daniel.merrill at psware dot com
  2015-04-29 10:50 ` [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order ebotcazou at gcc dot gnu.org
@ 2015-04-29 11:15 ` ebotcazou at gcc dot gnu.org
  2015-04-30 15:02 ` ebotcazou at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-04-29 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> When an array of Long_Floats is set to a scalar_storage_order of
> High_Order_First, only the two 32 bit words that make up the 64 bit value
> are swapped with each other but the bytes under those words are not swapped
> properly. Attached is a simple program that reproduces the behavior.

I'm actually seeing exactly the reverse effect: in Low_Order_First

power_of_two.4177:
        .long   0
        .long   1072693248
        .long   0
        .long   1073741824

and in High_Order_First:

power_of_two.4177:
        .long   0
        .long   61503
        .long   0
        .long   64

so correct byte-swapping but missing word-swapping.


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

* [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order
  2015-03-19 22:11 [Bug ada/65476] New: Long_Float array does not byte swap correctly when set to Scalar_Storage_Order with High Order First daniel.merrill at psware dot com
  2015-04-29 10:50 ` [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order ebotcazou at gcc dot gnu.org
  2015-04-29 11:15 ` ebotcazou at gcc dot gnu.org
@ 2015-04-30 15:02 ` ebotcazou at gcc dot gnu.org
  2015-04-30 15:03 ` ebotcazou at gcc dot gnu.org
  2015-05-01 13:24 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-04-30 15:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Author: ebotcazou
Date: Thu Apr 30 15:01:49 2015
New Revision: 222633

URL: https://gcc.gnu.org/viewcvs?rev=222633&root=gcc&view=rev
Log:
        PR ada/65476
        * fold-const.c (native_encode_int): Revert all changes.
        (native_encode_real): Likewise.
        (native_encode_fixed): Likewise.
        (native_encode_complex): Likewise.
        (native_encode_vector): Likewise.
        (native_encode_expr): Likewise.
        (fold_flip_storage_order): Delete.
        (fold_view_convert_expr): Adjust call to native_encode_expr.
        (fold_ternary_loc): Adjust call to native_encode_expr.
        * fold-const.h (native_encode_expr): Adjust back prototype.
        (fold_flip_storage_order): Delete.
        * dwarf2out.c (native_encode_initializer): Adjust.
        * output.h (assemble_real): Adjust prototype.
        * varasm.c (assemble_real): Add REVERSE parameter.  Flip the storage
        order of the value if REVERSE is true.
        (output_constant_pool_2): Adjust call to assemble_real.
        (output_constant) <INTEGER_TYPE>: Adjust.
        <REAL_TYPE>: Adjust call to assemble_real.
        * config/arm/arm.md (consttable_4): Adjust call to assemble_real.
        (consttable_8): Likewise.
        (consttable_16): Likewise.
        * config/mips/mips.md (consttable_float): Likewise.
        * config/s390/s390.c (s390_output_pool_entry): Likewise.
        * config/sh/sh.md (consttable_sf): Likewise.
        (consttable_df): Likewise.
testsuite/
        * c-c++-common/sso/init9.h: New.
        * c-c++-common/sso/p9.c: Likewise.
        * c-c++-common/sso/q9.c: Likewise.
        * c-c++-common/sso/t9.c: Likewise.
        * gnat.dg/sso: Adjust.

Added:
    branches/scalar-storage-order/gcc/testsuite/c-c++-common/sso/init9.h
    branches/scalar-storage-order/gcc/testsuite/c-c++-common/sso/p9.c
    branches/scalar-storage-order/gcc/testsuite/c-c++-common/sso/q9.c
    branches/scalar-storage-order/gcc/testsuite/c-c++-common/sso/t9.c
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/init11.ads
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/p11.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q11.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/r11.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/s11.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/t11.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/u11.adb
Removed:
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/r10.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/s10.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/u10.adb
Modified:
    branches/scalar-storage-order/gcc/config/arm/arm.md
    branches/scalar-storage-order/gcc/config/mips/mips.md
    branches/scalar-storage-order/gcc/config/s390/s390.c
    branches/scalar-storage-order/gcc/config/sh/sh.md
    branches/scalar-storage-order/gcc/dwarf2out.c
    branches/scalar-storage-order/gcc/fold-const.c
    branches/scalar-storage-order/gcc/fold-const.h
    branches/scalar-storage-order/gcc/output.h
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/init10.ads
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/init9.ads
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/p10.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/p9.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q1.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q10.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q2.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q3.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q4.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q5.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q6.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q7.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q8.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/q9.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/t10.adb
    branches/scalar-storage-order/gcc/testsuite/gnat.dg/sso/t9.adb
    branches/scalar-storage-order/gcc/varasm.c


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

* [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order
  2015-03-19 22:11 [Bug ada/65476] New: Long_Float array does not byte swap correctly when set to Scalar_Storage_Order with High Order First daniel.merrill at psware dot com
                   ` (2 preceding siblings ...)
  2015-04-30 15:02 ` ebotcazou at gcc dot gnu.org
@ 2015-04-30 15:03 ` ebotcazou at gcc dot gnu.org
  2015-05-01 13:24 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-04-30 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |6.0

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixed on the branch.


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

* [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order
  2015-03-19 22:11 [Bug ada/65476] New: Long_Float array does not byte swap correctly when set to Scalar_Storage_Order with High Order First daniel.merrill at psware dot com
                   ` (3 preceding siblings ...)
  2015-04-30 15:03 ` ebotcazou at gcc dot gnu.org
@ 2015-05-01 13:24 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-05-01 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Author: ebotcazou
Date: Fri May  1 13:24:16 2015
New Revision: 222680

URL: https://gcc.gnu.org/viewcvs?rev=222680&root=gcc&view=rev
Log:
        PR ada/65476
        * config/arm/arm.c (arm_assemble_integer): Adjust call to assemble_real

Modified:
    branches/scalar-storage-order/gcc/config/arm/arm.c


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

end of thread, other threads:[~2015-05-01 13:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19 22:11 [Bug ada/65476] New: Long_Float array does not byte swap correctly when set to Scalar_Storage_Order with High Order First daniel.merrill at psware dot com
2015-04-29 10:50 ` [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order ebotcazou at gcc dot gnu.org
2015-04-29 11:15 ` ebotcazou at gcc dot gnu.org
2015-04-30 15:02 ` ebotcazou at gcc dot gnu.org
2015-04-30 15:03 ` ebotcazou at gcc dot gnu.org
2015-05-01 13:24 ` ebotcazou 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).