[Bug c/51628] __attribute__((packed)) is unsafe in some cases

2018-01-12 Thread alexey.salmin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51628 Alexey Salmin changed: What|Removed |Added CC||alexey.salmin at gmail dot com

[Bug c/51628] __attribute__((packed)) is unsafe in some cases

2018-01-16 Thread alexey.salmin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51628 --- Comment #39 from Alexey Salmin --- Thank you, this patch works for me. Gives a warning in the attached test case, but still allows to take an address of a packed struct members when the packed attribute is preserved in the pointer.

[Bug c/51628] __attribute__((packed)) is unsafe in some cases

2018-01-17 Thread alexey.salmin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51628 --- Comment #42 from Alexey Salmin --- Sorry for being unclear. When I need a pointer to an unaligned type I wrap it in a struct. E.g. a fix for SIGSEGV from comment#36 would look like this: struct pair_t { char c; __int128_t i; } __att

[Bug c/51628] __attribute__((packed)) is unsafe in some cases

2018-01-18 Thread alexey.salmin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51628 --- Comment #46 from Alexey Salmin --- Tested the latest patch, behavior looks very reasonable even in tricky cases. 1) No warning, gcd(12, 8) == 4 struct tuple_t { char c[12]; __int128_t i; } __attribute__((packed, align

[Bug c++/83271] New: const variable previously declared "extern" results in "weak declaration must be public" error

2017-12-04 Thread alexey.salmin at gmail dot com
Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: alexey.salmin at gmail dot com Target Milestone: --- The following code works well and produces a global read-only symbol:

[Bug c++/83271] const variable previously declared "extern" results in "weak declaration must be public" error

2017-12-04 Thread alexey.salmin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83271 --- Comment #2 from Alexey Salmin --- (In reply to Jakub Jelinek from comment #1) > I must say I fail to see usefulness of adding the attribute to the > definition rather than declaration though. Here's my case. There's a const bool flag in a st

[Bug c++/83271] const variable previously declared "extern" results in "weak declaration must be public" error

2017-12-04 Thread alexey.salmin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83271 --- Comment #4 from Alexey Salmin --- (In reply to Jonathan Wakely from comment #3) > At least there's a simple workaround (adding 'extern' to the definition > where the attribute). That's what we do, so this is really a minor bug. Still, I deci