public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nightstrike at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/108150] New: gcc.dg/attr-aligned.c fails with incorrect max alignment
Date: Sat, 17 Dec 2022 01:40:37 +0000	[thread overview]
Message-ID: <bug-108150-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108150
           Summary: gcc.dg/attr-aligned.c fails with incorrect max
                    alignment
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nightstrike at gmail dot com
  Target Milestone: ---

On Windows targets, the max alignment is 8192.  However, this test winds up
assuming the max alignment is much larger, causing multiple failures. 
Specifically, the test is getting into:

#elif __powerpc64__ || __x86_64__
/* Is this processor- or operating-system specific?  */
#  define ALIGN_MAX_STATIC      ALIGN_MAX_HARD

and ALIGN_MAX_HARD is set to:

/* The maximum alignment GCC can handle.  */
#define ALIGN_MAX_HARD 0x10000000


If it fell through to:
#else
   /* Guaranteed to be accepted regardless of the target.  */
#  define ALIGN_MAX_STATIC      __BIGGEST_ALIGNMENT__

that would still be wrong, as __BIGGEST_ALIGNMENT__ is set to 16.


Another case that checks for Windows and sets it to 8192 should fix it.  The
check should cover all windows platforms, including cygwin and msys. 
Technically, msys defines both __MSYS__ and __CYGWIN__, so testing for
__CYGWIN__ || __MINGW32__ || __MINGW64__ would cover all bases.  Alternatively,
and potentially easier, __WINT_MAX__ is defined on all targets, so you could
just test for that.


Someone will likely want to do it perhaps in a more sophisticated way, or be
more obvious about the macros being tested if WINT_MAX is an obscure choice, or
some other reason.  However, the following change works:

diff --git a/gcc/testsuite/gcc.dg/attr-aligned.c
b/gcc/testsuite/gcc.dg/attr-aligned.c
index a2e11c96180..a56973c99b4 100644
--- a/gcc/testsuite/gcc.dg/attr-aligned.c
+++ b/gcc/testsuite/gcc.dg/attr-aligned.c
@@ -22,6 +22,9 @@
 #  define ALIGN_MAX_STATIC      2
 /* Work around a pdp11 ICE (see PR target/87821).  */
 #  define ALIGN_MAX_AUTO        (ALIGN_MAX_HARD >> 14)
+#elif __WINT_MAX__
+#  define ALIGN_MAX_STATIC      8192
+#  define ALIGN_MAX_AUTO        8192
 #elif __powerpc64__ || __x86_64__
 /* Is this processor- or operating-system specific?  */
 #  define ALIGN_MAX_STATIC      ALIGN_MAX_HARD


For reference, these are the excess errors:
gcc/testsuite/gcc.dg/attr-aligned.c:65:1: error: requested alignment
'268435456' exceeds object file maximum 8192
gcc/testsuite/gcc.dg/attr-aligned.c:66:1: error: requested alignment
'268435456' exceeds object file maximum 8192
gcc/testsuite/gcc.dg/attr-aligned.c:67:1: error: requested alignment
'268435456' exceeds object file maximum 8192
gcc/testsuite/gcc.dg/attr-aligned.c:68:1: error: requested alignment
'268435456' exceeds object file maximum 8192
gcc/testsuite/gcc.dg/attr-aligned.c:70:1: error: static assertion failed
gcc/testsuite/gcc.dg/attr-aligned.c:71:1: error: static assertion failed
gcc/testsuite/gcc.dg/attr-aligned.c:72:1: error: static assertion failed
gcc/testsuite/gcc.dg/attr-aligned.c:73:1: error: static assertion failed
gcc/testsuite/gcc.dg/attr-aligned.c:61:22: error: alignment of 't_max' is
greater than maximum object file alignment 8192
gcc/testsuite/gcc.dg/attr-aligned.c:78:47: error: alignment of 'alignas_sc_max'
is greater than maximum object file alignment 8192
gcc/testsuite/gcc.dg/attr-aligned.c:79:40: error: alignment of 'alignas_c_max'
is greater than maximum object file alignment 8192
gcc/testsuite/gcc.dg/attr-aligned.c:80:34: error: alignment of 'alignas_v_max'
is greater than maximum object file alignment 8192
gcc/testsuite/gcc.dg/attr-aligned.c:99:31: error: alignment of 'aligned_st_max'
is greater than maximum object file alignment 8192

             reply	other threads:[~2022-12-17  1:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-17  1:40 nightstrike at gmail dot com [this message]
2022-12-19  8:19 ` [Bug testsuite/108150] " nightstrike at gmail dot com
2022-12-27 22:43 ` nightstrike at gmail dot com
2023-01-08  1:33 ` 10walls at gmail dot com
2023-01-28 16:32 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108150-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).