public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/35186]  New: Ada doesn't follow i386 psABI
@ 2008-02-13 19:21 hjl dot tools at gmail dot com
  2008-02-13 19:23 ` [Bug ada/35186] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-02-13 19:21 UTC (permalink / raw)
  To: gcc-bugs

DImode is aligned at 4 byte according to i386 psABI. This 4.4 patch

http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00184.html

will use 4byte alignment for DImode. But Ada doesn't follow i386 psABI.
validate_alignment in ada/decl.c does

new_align = UI_To_Int (alignment);
...
align = MAX (align, new_align == 0 ? 1 : new_align * BITS_PER_UNIT);

It changes DImode alignment from 32bit to 64bit and turns DImode integer
into a DImode record. As the result, Ada fails to compile s-pack33.adb:

s-pack33.adb:52:49: size for "E0" too small, minimum allowed is 64
s-pack33.adb:53:49: size for "E1" too small, minimum allowed is 64
s-pack33.adb:54:49: size for "E2" too small, minimum allowed is 64
s-pack33.adb:55:49: size for "E3" too small, minimum allowed is 64
s-pack33.adb:56:49: size for "E4" too small, minimum allowed is 64
s-pack33.adb:57:49: size for "E5" too small, minimum allowed is 64
s-pack33.adb:58:49: size for "E6" too small, minimum allowed is 64
s-pack33.adb:59:49: size for "E7" too small, minimum allowed is 64
s-pack33.adb:62:30: size for "Cluster" too small, minimum allowed is 512

because validate_size has

(gdb) call debug_tree (size)
 <integer_cst 0xb7d0d4d0 type <integer_type 0xb7cf8068 bit_size_type> constant
invariant 33>
(gdb) call debug_tree (type_size)
 <integer_cst 0xb7ceb738 type <integer_type 0xb7cf8068 bit_size_type> constant
invariant visited 64>
(gdb) call debug_tree (gnu_type)
 <record_type 0xb7d0ed00 system__pack_33__bits_33___PAD sizes-gimplified
asm_written visited type_5 DI
    size <integer_cst 0xb7ceb738 type <integer_type 0xb7cf8068 bit_size_type>
constant invariant visited 64>
    unit size <integer_cst 0xb7ceb754 type <integer_type 0xb7cf8000 long int>
constant invariant visited 8>
    align 64 symtab -1210166256 alias set -1 canonical type 0xb7d0ed00
    fields <field_decl 0xb7d052e0 F
        type <integer_type 0xb7d0ec98 system__pack_33__bits_33 type
<integer_type 0xb7d0ec30 system__pack_33__bits_33___UMT>
            sizes-gimplified asm_written visited unsigned type_2 DI size
<integer_cst 0xb7ceb738 64> unit size <integer_cst 0xb7ceb754 8>
            align 32 symtab -1210166464 alias set -1 canonical type 0xb7d0ec98
precision 64 min <integer_cst 0xb7d0d364 0> max <integer_cst 0xb7d0d3f0
0x1ffffffff>>
        unsigned decl_3 decl_5 DI file s-pack33.ads line 6 col 9 size
<integer_cst 0xb7ceb738 64> unit size <integer_cst 0xb7ceb754 8>
        align 32 offset_align 128
        offset <integer_cst 0xb7ceb968 constant invariant visited 0>
        bit offset <integer_cst 0xb7ceb984 constant invariant 0> context
<record_type 0xb7d0ed00 system__pack_33__bits_33___PAD>> Ada size <integer_cst
0xb7ceb738 64>
    chain <type_decl 0xb7d0edd0 system__pack_33__bits_33___PAD>>
(gdb) 

Before my patch, validate_size has

(gdb) call debug_tree (size)
 <integer_cst 0xb7c9f444 type <integer_type 0xb7c8a068 bit_size_type> constant
invariant 33>
(gdb) 
 <integer_cst 0xb7c9f444 type <integer_type 0xb7c8a068 bit_size_type> constant
invariant 33>
(gdb) call debug_tree (type_size)
 <integer_cst 0xb7c9f444 type <integer_type 0xb7c8a068 bit_size_type> constant
invariant 33>
(gdb) call debug_tree (gnu_type)
 <integer_type 0xb7ca0c98 system__pack_33__bits_33
    type <integer_type 0xb7ca0c30 system__pack_33__bits_33___UMT public
unsigned type_1 DI
        size <integer_cst 0xb7c7d738 constant invariant visited 64>
        unit size <integer_cst 0xb7c7d754 constant invariant visited 8>
        align 64 symtab -1208441944 alias set -1 canonical type 0xb7ca0c30
precision 64 min <integer_cst 0xb7c9f364 0> max <integer_cst 0xb7c9894c -1>
        modulus <integer_cst 0xb7c9f3d4 constant invariant 0x200000000>>
    sizes-gimplified visited unsigned type_2 DI size <integer_cst 0xb7c7d738
64> unit size <integer_cst 0xb7c7d754 8>
    align 64 symtab -1208442048 alias set -1 canonical type 0xb7ca0c98
precision 64 min <integer_cst 0xb7c9f364 0> max <integer_cst 0xb7c9f3f0
0x1ffffffff>
    RM size <integer_cst 0xb7c9f444 type <integer_type 0xb7c8a068
bit_size_type> constant invariant 33>>
(gdb)


-- 
           Summary: Ada doesn't follow i386 psABI
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2008-03-25 18:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-13 19:21 [Bug ada/35186] New: Ada doesn't follow i386 psABI hjl dot tools at gmail dot com
2008-02-13 19:23 ` [Bug ada/35186] " pinskia at gcc dot gnu dot org
2008-02-13 19:35 ` hjl dot tools at gmail dot com
2008-02-13 19:38 ` hjl dot tools at gmail dot com
2008-02-13 19:40 ` [Bug ada/35186] Implicit assumptions about alignment of DImode ebotcazou at gcc dot gnu dot org
2008-02-13 19:51 ` ebotcazou at gcc dot gnu dot org
2008-02-19 14:37 ` hjl at gcc dot gnu dot org
2008-03-06  0:46 ` [Bug ada/35186] implicit assumption " ebotcazou at gcc dot gnu dot org
2008-03-06  0:48 ` ebotcazou at gcc dot gnu dot org
2008-03-25 18:00 ` ebotcazou at gcc dot gnu dot 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).