New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 665240 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

ec-utils does not build with latest llvm

Project Member Reported by manojgupta@chromium.org, Nov 15 2016

Issue description

util/ectool.c:1158:21: error: taking address of packed member 'size' of class or structure 'ec_params_usb_pd_fw_update' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]

uint32_t *data = &(p->size) + 1;

 
Project Member

Comment 1 by bugdroid1@chromium.org, Nov 16 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/ec/+/b2bc2341978884cf0bde01c1b9de06ea0c092576

commit b2bc2341978884cf0bde01c1b9de06ea0c092576
Author: Manoj Gupta <manojgupta@google.com>
Date: Mon Nov 14 19:27:29 2016

Fix EC build for latest llvm

BRANCH=none

util/ectool.c:1158 merror: taking address of packed member 'size' of class
or structure 'ec_params_usb_pd_fw_update' may result in an unaligned
pointer value [-Werror,-Waddress-of-packed-member]

For this case, the pointer is always aligned but clang complains.
Workaround using double pointer casts to char and uint.

       uint32_t *data = &(p->size) + 1;

BUG= chromium:665240 
TEST=Builds now

Change-Id: Ibccf0f6e409b9724fc9e5acf28dde570e9d341e3
Reviewed-on: https://chromium-review.googlesource.com/411384
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[modify] https://crrev.com/b2bc2341978884cf0bde01c1b9de06ea0c092576/util/ectool.c

Status: Fixed (was: Untriaged)

Comment 3 by vapier@chromium.org, Nov 17 2016

the CL is a workaround, but it points to a closed bug.  so where is the upstream bug ?
I am still waiting to get llvm account. If I do not get it by tomorrow, I will ask someone with an account to file a bug report.
Yunlian opened llvm bug 

https://llvm.org/bugs/show_bug.cgi?id=31050
Bug is fixed in llvm trunk. Yunlian is backporting it. I'll remove the unnecessary casts after that.
Project Member

Comment 7 by bugdroid1@chromium.org, Nov 19 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/d78c13b7d51b19bd98893d5d8a3e1cac798d3d15

commit d78c13b7d51b19bd98893d5d8a3e1cac798d3d15
Author: Yunlian Jiang <yunlian@google.com>
Date: Fri Nov 18 21:53:30 2016

llvm: cherry pick a patch for llvm-next.

commit d6168b6ed57fe78bf42f57509d73bde2680105b5
Author: Roger Ferrer Ibanez <roger.ferreribanez@arm.com>
Date:   Mon Nov 14 08:53:27 2016 +0000

    Remove some false positives when taking the address of packed members

    Differential Revision: https://reviews.llvm.org/D23657

This cherry picks an upstream patch to fix the false positive warning
of -Waddress-of-packed-member.

BUG= chromium:665240 
TEST=the false positive warning is gone.

Change-Id: Ied873f9e221e9676d183d9b2af48791f5afdbb06
Reviewed-on: https://chromium-review.googlesource.com/413040
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Luis Lozano <llozano@chromium.org>

[add] https://crrev.com/d78c13b7d51b19bd98893d5d8a3e1cac798d3d15/sys-devel/llvm/files/cherry/d6168b6ed57fe78bf42f57509d73bde2680105b5.patch
[rename] https://crrev.com/d78c13b7d51b19bd98893d5d8a3e1cac798d3d15/sys-devel/llvm/llvm-3.9_pre265926-r16.ebuild

Project Member

Comment 8 by bugdroid1@chromium.org, Nov 20 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/ec/+/2228b76f740dc7eeca43c446d0bd19882e819f9c

commit 2228b76f740dc7eeca43c446d0bd19882e819f9c
Author: Manoj Gupta <manojgupta@google.com>
Date: Fri Nov 18 19:08:46 2016

Fix EC build for latest llvm

llvm bug: https://llvm.org/bugs/show_bug.cgi?id=31050 is now fixed
So remove unnecessary pointer casts.

BRANCH=none
BUG= chromium:665240 
TEST=Builds now

Change-Id: I5695a9605b5ab47d11f7e9ecacc52f2ba53385e7
Reviewed-on: https://chromium-review.googlesource.com/412880
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[modify] https://crrev.com/2228b76f740dc7eeca43c446d0bd19882e819f9c/util/ectool.c

Project Member

Comment 9 by bugdroid1@chromium.org, Nov 22 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/ec/+/0e4776ec287ce92ce61ef9abae179330f4120aad

commit 0e4776ec287ce92ce61ef9abae179330f4120aad
Author: Manoj Gupta <manojgupta@google.com>
Date: Mon Nov 21 20:15:08 2016

Fix EC build for latest llvm for elm board

Mark host command structures as aligned for elm board.
Without marking as aligned, llvm was correctly complaining about
taking address of packed member.

util/ectool.c:1158 error: taking address of packed member 'size' of
class or structure 'ec_params_usb_pd_fw_update' may result in an
unaligned pointer value [-Werror,-Waddress-of-packed-member]

BRANCH=none
BUG= chromium:665240 
TEST=Builds now

Change-Id: Ic4a2e81f6af8ef2a906d6ac7aca87ea6d00fe318
Reviewed-on: https://chromium-review.googlesource.com/413108
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>

[modify] https://crrev.com/0e4776ec287ce92ce61ef9abae179330f4120aad/board/elm/board.h

Comment 10 by dchan@google.com, Mar 4 2017

Labels: VerifyIn-58
Status: Verified (was: Fixed)

Sign in to add a comment