New issue
Advanced search Search tips

Issue 619640 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

"taking address of packed member" errors on Clang ToT bots

Project Member Reported by euge...@google.com, Jun 13 2016

Issue description

https://build.chromium.org/p/chromium.fyi/builders/CFI%20Linux%20ToT/builds/3045/steps/compile/logs/stdio

../../third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c:5928:29: error: taking address of packed member 'time_entered' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
        (void)SCTP_GETTIME_TIMEVAL(&stc.time_entered);
                                   ^~~~~~~~~~~~~~~~~
../../third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_constants.h:1020:46: note: expanded from macro 'SCTP_GETTIME_TIMEVAL'
#define SCTP_GETTIME_TIMEVAL(x) gettimeofday(x, NULL)
                                             ^
../../third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c:6075:11: error: taking address of packed member 'address' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
                        memcpy(&stc.address, &srcconn->sconn_addr, sizeof(void *));
                               ^~~~~~~~~~~~
../../third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c:6082:11: error: taking address of packed member 'laddress' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
                        memcpy(&stc.laddress, &dstconn->sconn_addr, sizeof(void *));
                               ^~~~~~~~~~~~~
../../third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c:6185:11: error: taking address of packed member 'address' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
                        memcpy(&stc.address, &sconn->sconn_addr, sizeof(void *));
                               ^~~~~~~~~~~~
../../third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c:6191:11: error: taking address of packed member 'laddress' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
                        memcpy(&stc.laddress, &sconn->sconn_addr, sizeof(void *));
                               ^~~~~~~~~~~~~

https://build.chromium.org/p/chromium.fyi/builders/ClangToTMac/builds/9681/steps/compile/logs/stdio

and more, triggered by this upstream revision:
http://llvm.org/viewvc/llvm-project?rev=272552&view=rev

 
Project Member

Comment 1 by bugdroid1@chromium.org, Jun 13 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e

commit e77a373b7141f2e52f79f5cba5c2577fc16a4f5e
Author: eugenis <eugenis@chromium.org>
Date: Mon Jun 13 22:18:03 2016

Disable "taking address of packed member" clang warning.

Pending cleanup.

BUG=619640

Review-Url: https://codereview.chromium.org/2059143003
Cr-Commit-Position: refs/heads/master@{#399572}

[modify] https://crrev.com/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e/build/common.gypi
[modify] https://crrev.com/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e/build/config/compiler/BUILD.gn

Comment 2 by euge...@google.com, Jun 13 2016

Owner: ----
Status: Available (was: Started)
Unassigning myself: I don't plan to do the cleanup.
Project Member

Comment 3 by bugdroid1@chromium.org, Jun 14 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f999d8350f0fbdefac8875135ca3540c64d2f3f4

commit f999d8350f0fbdefac8875135ca3540c64d2f3f4
Author: thakis <thakis@chromium.org>
Date: Tue Jun 14 12:37:26 2016

Revert of Disable "taking address of packed member" clang warning. (patchset #3 id:40001 of https://codereview.chromium.org/2059143003/ )

Reason for revert:
The warning got reverted upstream.

Original issue's description:
> Disable "taking address of packed member" clang warning.
>
> Pending cleanup.
>
> BUG=619640
>
> Committed: https://crrev.com/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e
> Cr-Commit-Position: refs/heads/master@{#399572}

TBR=dpranke@chromium.org,hans@chromium.org,eugenis@google.com,eugenis@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=619640

Review-Url: https://codereview.chromium.org/2066503004
Cr-Commit-Position: refs/heads/master@{#399686}

[modify] https://crrev.com/f999d8350f0fbdefac8875135ca3540c64d2f3f4/build/common.gypi
[modify] https://crrev.com/f999d8350f0fbdefac8875135ca3540c64d2f3f4/build/config/compiler/BUILD.gn

Project Member

Comment 4 by sheriffbot@chromium.org, Jun 14 2016

Labels: Hotlist-Google
Project Member

Comment 5 by bugdroid1@chromium.org, Jun 15 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e

commit e77a373b7141f2e52f79f5cba5c2577fc16a4f5e
Author: eugenis <eugenis@chromium.org>
Date: Mon Jun 13 22:18:03 2016

Disable "taking address of packed member" clang warning.

Pending cleanup.

BUG=619640

Review-Url: https://codereview.chromium.org/2059143003
Cr-Commit-Position: refs/heads/master@{#399572}

[modify] https://crrev.com/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e/build/common.gypi
[modify] https://crrev.com/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e/build/config/compiler/BUILD.gn

Project Member

Comment 6 by bugdroid1@chromium.org, Jun 15 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f999d8350f0fbdefac8875135ca3540c64d2f3f4

commit f999d8350f0fbdefac8875135ca3540c64d2f3f4
Author: thakis <thakis@chromium.org>
Date: Tue Jun 14 12:37:26 2016

Revert of Disable "taking address of packed member" clang warning. (patchset #3 id:40001 of https://codereview.chromium.org/2059143003/ )

Reason for revert:
The warning got reverted upstream.

Original issue's description:
> Disable "taking address of packed member" clang warning.
>
> Pending cleanup.
>
> BUG=619640
>
> Committed: https://crrev.com/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e
> Cr-Commit-Position: refs/heads/master@{#399572}

TBR=dpranke@chromium.org,hans@chromium.org,eugenis@google.com,eugenis@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=619640

Review-Url: https://codereview.chromium.org/2066503004
Cr-Commit-Position: refs/heads/master@{#399686}

[modify] https://crrev.com/f999d8350f0fbdefac8875135ca3540c64d2f3f4/build/common.gypi
[modify] https://crrev.com/f999d8350f0fbdefac8875135ca3540c64d2f3f4/build/config/compiler/BUILD.gn

Comment 7 by r...@chromium.org, Jul 14 2016

Cc: r...@chromium.org thakis@chromium.org
-Waddress-of-packed-member was relanded in r275417 this morning, so I'll reland our -Wno patch.

Comment 8 by thakis@chromium.org, Jul 14 2016

The CL claims to have fixed false positives -- are the remaining instances real?

Comment 9 by r...@chromium.org, Jul 14 2016

I would say they are true positives:

../../third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c:1708:15: error: taking address of packed member 'time_entered' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
                                                              &cookie->time_entered,
                                                               ^~~~~~~~~~~~~~~~~~~~
../../third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c:2458:10: error: taking address of packed member 'time_entered' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
                                                  &cookie->time_entered, sctp_align_unsafe_makecopy,

It's address is taken and passed to another function without lowering its alignment.

Comment 10 by r...@chromium.org, Jul 14 2016

A questionable instance on Mac:

../../third_party/crashpad/crashpad/util/mach/exc_server_variants_test.cc:231:25: error: binding reference to packed member 'new_state' of class or structure 'crashpad::test::(anonymous namespace)::ExceptionRaiseStateReply'
    EXPECT_EQ(arraysize(new_state), new_stateCnt);
                        ^~~~~~~~~
../../base/macros.h:49:50: note: expanded from macro 'arraysize'
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
                                                 ^~~~~

The 'new_state' array is declared in a structure with 4-byte packed alignment and has 64-bit elements, so yeah, it's binding an 8 byte aligned reference to a 4 byte aligned object, but the reference is only used to compute the array size.
Project Member

Comment 11 by bugdroid1@chromium.org, Jul 14 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/805bf6aaa5de841e0cf987e0d7005f5abd7df54c

commit 805bf6aaa5de841e0cf987e0d7005f5abd7df54c
Author: rnk <rnk@chromium.org>
Date: Thu Jul 14 19:25:34 2016

Reland of Disable "taking address of packed member" clang warning. (patchset #1 id:1 of https://codereview.chromium.org/2066503004/ )

Reason for revert:
The warning was relanded upstream this morning.

Original issue's description:
> Revert of Disable "taking address of packed member" clang warning. (patchset #3 id:40001 of https://codereview.chromium.org/2059143003/ )
>
> Reason for revert:
> The warning got reverted upstream.
>
> Original issue's description:
> > Disable "taking address of packed member" clang warning.
> >
> > Pending cleanup.
> >
> > BUG=619640
> >
> > Committed: https://crrev.com/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e
> > Cr-Commit-Position: refs/heads/master@{#399572}
>
> TBR=dpranke@chromium.org,hans@chromium.org,eugenis@google.com,eugenis@chromium.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=619640
>
> Committed: https://crrev.com/f999d8350f0fbdefac8875135ca3540c64d2f3f4
> Cr-Commit-Position: refs/heads/master@{#399686}

TBR=dpranke@chromium.org,hans@chromium.org,eugenis@google.com,eugenis@chromium.org,thakis@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=619640

Review-Url: https://codereview.chromium.org/2148283002
Cr-Commit-Position: refs/heads/master@{#405538}

[modify] https://crrev.com/805bf6aaa5de841e0cf987e0d7005f5abd7df54c/build/common.gypi
[modify] https://crrev.com/805bf6aaa5de841e0cf987e0d7005f5abd7df54c/build/config/compiler/BUILD.gn

Project Member

Comment 12 by bugdroid1@chromium.org, Jul 14 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9055c04e9973804ab9941b18f4b5efc18bfdbdc2

commit 9055c04e9973804ab9941b18f4b5efc18bfdbdc2
Author: thakis <thakis@chromium.org>
Date: Thu Jul 14 20:45:30 2016

Revert of Disable "taking address of packed member" clang warning. (patchset #2 id:60001 of https://codereview.chromium.org/2148283002/ )

Reason for revert:
Warning was reverted upstream again.

Original issue's description:
> Reland of Disable "taking address of packed member" clang warning. (patchset #1 id:1 of https://codereview.chromium.org/2066503004/ )
>
> Reason for revert:
> The warning was relanded upstream this morning.
>
> Original issue's description:
> > Revert of Disable "taking address of packed member" clang warning. (patchset #3 id:40001 of https://codereview.chromium.org/2059143003/ )
> >
> > Reason for revert:
> > The warning got reverted upstream.
> >
> > Original issue's description:
> > > Disable "taking address of packed member" clang warning.
> > >
> > > Pending cleanup.
> > >
> > > BUG=619640
> > >
> > > Committed: https://crrev.com/e77a373b7141f2e52f79f5cba5c2577fc16a4f5e
> > > Cr-Commit-Position: refs/heads/master@{#399572}
> >
> > TBR=dpranke@chromium.org,hans@chromium.org,eugenis@google.com,eugenis@chromium.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=619640
> >
> > Committed: https://crrev.com/f999d8350f0fbdefac8875135ca3540c64d2f3f4
> > Cr-Commit-Position: refs/heads/master@{#399686}
>
> TBR=dpranke@chromium.org,hans@chromium.org,eugenis@google.com,eugenis@chromium.org,thakis@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=619640
>
> Committed: https://crrev.com/805bf6aaa5de841e0cf987e0d7005f5abd7df54c
> Cr-Commit-Position: refs/heads/master@{#405538}

TBR=dpranke@chromium.org,hans@chromium.org,eugenis@google.com,eugenis@chromium.org,rnk@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=619640

Review-Url: https://codereview.chromium.org/2145243003
Cr-Commit-Position: refs/heads/master@{#405560}

[modify] https://crrev.com/9055c04e9973804ab9941b18f4b5efc18bfdbdc2/build/common.gypi
[modify] https://crrev.com/9055c04e9973804ab9941b18f4b5efc18bfdbdc2/build/config/compiler/BUILD.gn

Comment 13 by r...@chromium.org, Aug 16 2016

Cc: h...@chromium.org
 Issue 637306  has been merged into this issue.

Comment 14 by r...@chromium.org, Aug 16 2016

Owner: h...@chromium.org
Currently the warning is back in clang (http://reviews.llvm.org/D20561 / r278483), so Hans put back -Wno-address-of-packed-member in https://codereview.chromium.org/2238303002 .
Project Member

Comment 15 by sheriffbot@chromium.org, Aug 17 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Hotlist-Recharge-Cold
Status: Available (was: Untriaged)
Components: Build
Labels: clang
Project Member

Comment 18 by bugdroid1@chromium.org, Jul 30

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8dc7a785f074af5f2b6022d36ceba09888bc30ea

commit 8dc7a785f074af5f2b6022d36ceba09888bc30ea
Author: Takuto Ikuta <tikuta@chromium.org>
Date: Mon Jul 30 12:44:39 2018

Remove -Wno-address-of-packed-member from default_warnings

This is just for command line flag clean up.

Bug: 619640
Change-Id: Ie0611e6ff15db10721a55c29e0665be1c4295561
Reviewed-on: https://chromium-review.googlesource.com/1154227
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Hans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579023}
[modify] https://crrev.com/8dc7a785f074af5f2b6022d36ceba09888bc30ea/build/config/compiler/BUILD.gn
[modify] https://crrev.com/8dc7a785f074af5f2b6022d36ceba09888bc30ea/chrome/utility/safe_browsing/mac/BUILD.gn

Status: Assigned (was: Available)

Sign in to add a comment