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

* [Bug ada/35186] Ada doesn't follow i386 psABI
  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 ` pinskia at gcc dot gnu dot org
  2008-02-13 19:35 ` hjl dot tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-02-13 19:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-02-13 19:22 -------
psABI is only for C last time I remembered.


-- 


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


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

* [Bug ada/35186] Ada doesn't follow i386 psABI
  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
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-02-13 19:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2008-02-13 19:35 -------
maybe_pad_type has

  if (align == TYPE_ALIGN (type))
    align = 0;

  if (align == 0 && !size)
    return type;
...
   record = make_node (RECORD_TYPE);

That is Ada expects 8 byte alignment for DImode. But TYPE_ALIGN (type),
which conforms to psABI, is 4 byte for DImode.


-- 


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


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

* [Bug ada/35186] Ada doesn't follow i386 psABI
  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
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-02-13 19:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl dot tools at gmail dot com  2008-02-13 19:37 -------
Ada should either define its own alignment, independent of psABI, or it
should just follow psABI for alignment.


-- 


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


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

* [Bug ada/35186] Implicit assumptions about alignment of DImode
  2008-02-13 19:21 [Bug ada/35186] New: Ada doesn't follow i386 psABI hjl dot tools at gmail dot com
                   ` (2 preceding siblings ...)
  2008-02-13 19:38 ` hjl dot tools at gmail dot com
@ 2008-02-13 19:40 ` ebotcazou at gcc dot gnu dot org
  2008-02-13 19:51 ` ebotcazou at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-02-13 19:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ebotcazou at gcc dot gnu dot org  2008-02-13 19:40 -------
Thanks for opening the PR  However:

> DImode is aligned at 4 byte according to i386 psABI.

Of course the psABI doesn't say anything about DImode, only about long long.

DImode is an internal concept of the GCC compiler.

> But Ada doesn't follow i386 psABI.

Ada doesn't have to abide by the psABI, except when it interfaces C.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
 GCC target triplet|i686-pc-linux-gnu           |ix86-*-*
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-13 19:40:12
               date|                            |
            Summary|Ada doesn't follow i386     |Implicit assumptions about
                   |psABI                       |alignment of DImode


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


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

* [Bug ada/35186] Implicit assumptions about alignment of DImode
  2008-02-13 19:21 [Bug ada/35186] New: Ada doesn't follow i386 psABI hjl dot tools at gmail dot com
                   ` (3 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-02-13 19:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ebotcazou at gcc dot gnu dot org  2008-02-13 19:50 -------
I'll look into this once 4.3.0 is released.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ebotcazou at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-02-13 19:40:12         |2008-02-13 19:50:25
               date|                            |


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


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

* [Bug ada/35186] Implicit assumptions about alignment of DImode
  2008-02-13 19:21 [Bug ada/35186] New: Ada doesn't follow i386 psABI hjl dot tools at gmail dot com
                   ` (4 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl at gcc dot gnu dot org @ 2008-02-19 14:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from hjl at gcc dot gnu dot org  2008-02-19 14:36 -------
Subject: Bug 35186

Author: hjl
Date: Tue Feb 19 14:35:48 2008
New Revision: 132433

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132433
Log:
2008-02-19  H.J. Lu  <hongjiu.lu@intel.com>

        PR Ada/35186
        * config/i386/i386-modes.def: Revert the last DI alignment
        change until Ada people can look into it.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386-modes.def


-- 


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


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

* [Bug ada/35186] implicit assumption about alignment of DImode
  2008-02-13 19:21 [Bug ada/35186] New: Ada doesn't follow i386 psABI hjl dot tools at gmail dot com
                   ` (5 preceding siblings ...)
  2008-02-19 14:37 ` hjl at gcc dot gnu dot org
@ 2008-03-06  0:46 ` 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
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-03-06  0:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ebotcazou at gcc dot gnu dot org  2008-03-06 00:45 -------
Subject: Bug 35186

Author: ebotcazou
Date: Thu Mar  6 00:44:11 2008
New Revision: 132963

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132963
Log:
        PR ada/35186
        * decl.c (maybe_pad_type): Avoid padding an integral type when
        bumping its alignment is sufficient.


Added:
    trunk/gcc/testsuite/gnat.dg/specs/pack33.ads
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug ada/35186] implicit assumption about alignment of DImode
  2008-02-13 19:21 [Bug ada/35186] New: Ada doesn't follow i386 psABI hjl dot tools at gmail dot com
                   ` (6 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-03-06  0:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from ebotcazou at gcc dot gnu dot org  2008-03-06 00:48 -------
This should be OK now.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2008-
                   |                            |03/msg00383.html
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug ada/35186] implicit assumption about alignment of DImode
  2008-02-13 19:21 [Bug ada/35186] New: Ada doesn't follow i386 psABI hjl dot tools at gmail dot com
                   ` (7 preceding siblings ...)
  2008-03-06  0:48 ` ebotcazou at gcc dot gnu dot org
@ 2008-03-25 18:00 ` ebotcazou at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-03-25 18:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from ebotcazou at gcc dot gnu dot org  2008-03-25 17:59 -------
Subject: Bug 35186

Author: ebotcazou
Date: Tue Mar 25 17:58:54 2008
New Revision: 133526

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133526
Log:
        Revert
        2008-03-05  Eric Botcazou  <ebotcazou@adacore.com>
        PR ada/35186
        * decl.c (maybe_pad_type): Avoid padding an integral type when
        bumping its alignment is sufficient.


Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/decl.c


-- 


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