public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jahns at dkrz dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/109403] New: Alignment of common blocks not reported correctly
Date: Tue, 04 Apr 2023 11:55:07 +0000	[thread overview]
Message-ID: <bug-109403-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 109403
           Summary: Alignment of common blocks not reported correctly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jahns at dkrz dot de
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

When compiling a source file with -flto, the alignment of common blocks seems
to not be reported from gcc-nm:

$ cat >align-test.f90 <<EOF
      MODULE CONFTEST_ALIGN
      USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT
      IMPLICIT NONE
      INTEGER(C_INT), PUBLIC, &
        BIND(c, name='align_test_variable') :: align_test_variable
      END MODULE CONFTEST_ALIGN
EOF
$ gfortran -flto -O2 -c -o align-test.o align-test.f90
$ gcc-nm align-test.o
00000000 C align_test_variable

Expected value was 4 byte alignment, but any value other than 0 would be
acceptable as long as it matches what the resulting DSO or program later
contains.

I tested this initially with gfortran 11.1 and 11.2 on Linux x86_64 because
that's what I have readily available and what I'm most interested in.

An equivalent C source exhibits the same problem:
$ echo "int align_test_variable __attribute__((common));" \
  | gcc -c -flto -x c - -o align-test-c.o
$ gcc-nm align-test-c.o 
00000000 C align_test_variable

Since no one seems to have reported similar experiences I expect to still find
this problem in most recent compiler versions.

             reply	other threads:[~2023-04-04 11:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 11:55 jahns at dkrz dot de [this message]
2023-04-11 12:27 ` [Bug lto/109403] " rguenth at gcc dot gnu.org
2023-07-11 11:57 ` jahns at dkrz dot de

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