public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/99492] New: double and double _Complex not aligned consistently on AIX
@ 2021-03-09 18:04 dje at gcc dot gnu.org
  2021-03-10  8:10 ` [Bug target/99492] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dje at gcc dot gnu.org @ 2021-03-09 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99492
           Summary: double and double _Complex not aligned consistently on
                    AIX
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dje at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc-ibm-aix*

extern "C" int printf(const char *, ...);
struct C {
    char c1;
    double _Complex c2;
};
struct D {
    char c1;
    double c2;
};
int main() {   
  printf("%lu\n", __alignof(double _Complex));
  printf("offsetof C.c2: %lu %lu\n", __builtin_offsetof(struct C, c2),
(unsigned long)&((struct C*)0)->c2);
  printf("%lu\n", __alignof(double));
  printf("offsetof D.c2: %lu %lu\n", __builtin_offsetof(struct D, c2),
(unsigned long)&((struct D*)0)->c2);
  return 0;
}

xlC/xlClang/clang on AIX all agree that D.c2 is at offset 4.

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

* [Bug target/99492] double and double _Complex not aligned consistently on AIX
  2021-03-09 18:04 [Bug target/99492] New: double and double _Complex not aligned consistently on AIX dje at gcc dot gnu.org
@ 2021-03-10  8:10 ` rguenth at gcc dot gnu.org
  2021-03-10 18:00 ` dje at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-10  8:10 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ABI

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I assume GCC puts it at offset 8?

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

* [Bug target/99492] double and double _Complex not aligned consistently on AIX
  2021-03-09 18:04 [Bug target/99492] New: double and double _Complex not aligned consistently on AIX dje at gcc dot gnu.org
  2021-03-10  8:10 ` [Bug target/99492] " rguenth at gcc dot gnu.org
@ 2021-03-10 18:00 ` dje at gcc dot gnu.org
  2021-03-10 23:51 ` cvs-commit at gcc dot gnu.org
  2021-03-12  3:25 ` dje at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dje at gcc dot gnu.org @ 2021-03-10 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-03-10
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from David Edelsohn <dje at gcc dot gnu.org> ---
Confirmed.

Yes, GCC does not follow the AIX ABI and places the double _Complex member at
offset 8 for natural alignment instead of 4 for AIX alignment, matching the
double member offset.

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

* [Bug target/99492] double and double _Complex not aligned consistently on AIX
  2021-03-09 18:04 [Bug target/99492] New: double and double _Complex not aligned consistently on AIX dje at gcc dot gnu.org
  2021-03-10  8:10 ` [Bug target/99492] " rguenth at gcc dot gnu.org
  2021-03-10 18:00 ` dje at gcc dot gnu.org
@ 2021-03-10 23:51 ` cvs-commit at gcc dot gnu.org
  2021-03-12  3:25 ` dje at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-10 23:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Edelsohn <dje@gcc.gnu.org>:

https://gcc.gnu.org/g:4fa6356be14414957be05bdf5e22037fe1bea283

commit r11-7615-g4fa6356be14414957be05bdf5e22037fe1bea283
Author: David Edelsohn <dje.gcc@gmail.com>
Date:   Tue Mar 9 17:52:36 2021 -0500

    aix: align double complex

    AIX word-aligns floating point doubles.  This behavior also extends to
    double _Complex, which had been overlooked when compiler support for
    double _Complex was added.

    This patch adds DCmode to the modes whose alignment is adjusted and
    adds a testcase to confirm the correct alignment.

    gcc/ChangeLog:

    2021-03-10  David Edelsohn  <dje.gcc@gmail.com>

            PR target/99492
            * config/rs6000/aix.h (ADJUST_FIELD_ALIGN): Add check for DCmode.
            * config/rs6000/rs6000.c (rs6000_special_round_type_align): Same.

    gcc/testsuite/ChangeLog:

    2021-03-10  David Edelsohn  <dje.gcc@gmail.com>

            PR target/99492
            * gcc.target/powerpc/pr99492.c: New testcase.

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

* [Bug target/99492] double and double _Complex not aligned consistently on AIX
  2021-03-09 18:04 [Bug target/99492] New: double and double _Complex not aligned consistently on AIX dje at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-03-10 23:51 ` cvs-commit at gcc dot gnu.org
@ 2021-03-12  3:25 ` dje at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dje at gcc dot gnu.org @ 2021-03-12  3:25 UTC (permalink / raw)
  To: gcc-bugs

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

David Edelsohn <dje at gcc dot gnu.org> changed:

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

--- Comment #4 from David Edelsohn <dje at gcc dot gnu.org> ---
Fixed

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

end of thread, other threads:[~2021-03-12  3:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 18:04 [Bug target/99492] New: double and double _Complex not aligned consistently on AIX dje at gcc dot gnu.org
2021-03-10  8:10 ` [Bug target/99492] " rguenth at gcc dot gnu.org
2021-03-10 18:00 ` dje at gcc dot gnu.org
2021-03-10 23:51 ` cvs-commit at gcc dot gnu.org
2021-03-12  3:25 ` dje 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).