public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50459] New: alignof doesn't work on plain old constant, works with expressions containing it
@ 2011-09-20 5:20 b.r.longbons at gmail dot com
2014-04-12 8:51 ` [Bug c/50459] " glisse at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: b.r.longbons at gmail dot com @ 2011-09-20 5:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50459
Bug #: 50459
Summary: alignof doesn't work on plain old constant, works with
expressions containing it
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: b.r.longbons@gmail.com
For certain types of constant, the exact form:
__attribute__((aligned(align)))
fails, even though 'align' can be used in other constant expressions.
Types of constants that fail:
// C
enum { align = 8 };
// C++
const int align = 8;
class Foo { static const int align = 8; };
// and lots of nasty template stuff
Anything that forms an expression succeeds, even if it's just (align).
sizeof() or a C++11 constexpr function also work.
Bad versions: 4.2.4, 4.3.6, 4.4.6, 4.5.3, 4.6.0, 4.6.1, and a couple of recent
builds from git.
Minimal testcase:
enum { align = 8 };
int succeeds __attribute__((aligned((align)) ));
int fails __attribute__((aligned(align) ));
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50459] alignof doesn't work on plain old constant, works with expressions containing it
2011-09-20 5:20 [Bug c/50459] New: alignof doesn't work on plain old constant, works with expressions containing it b.r.longbons at gmail dot com
@ 2014-04-12 8:51 ` glisse at gcc dot gnu.org
2014-04-14 11:55 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-04-12 8:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50459
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-04-12
Target Milestone|--- |4.10.0
Ever confirmed|0 |1
Known to fail| |4.9.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50459] alignof doesn't work on plain old constant, works with expressions containing it
2011-09-20 5:20 [Bug c/50459] New: alignof doesn't work on plain old constant, works with expressions containing it b.r.longbons at gmail dot com
2014-04-12 8:51 ` [Bug c/50459] " glisse at gcc dot gnu.org
@ 2014-04-14 11:55 ` mpolacek at gcc dot gnu.org
2014-04-14 12:51 ` mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-04-14 11:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50459
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Created attachment 32594
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32594&action=edit
pr50459
Yeah. This is regtested patch that covers even other attributes. If this
approach is ok then I can take this bug & post to ML.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50459] alignof doesn't work on plain old constant, works with expressions containing it
2011-09-20 5:20 [Bug c/50459] New: alignof doesn't work on plain old constant, works with expressions containing it b.r.longbons at gmail dot com
2014-04-12 8:51 ` [Bug c/50459] " glisse at gcc dot gnu.org
2014-04-14 11:55 ` mpolacek at gcc dot gnu.org
@ 2014-04-14 12:51 ` mpolacek at gcc dot gnu.org
2014-05-09 8:25 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-04-14 12:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50459
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Sure, thanks. I'll give it another round of testing and post to ML.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50459] alignof doesn't work on plain old constant, works with expressions containing it
2011-09-20 5:20 [Bug c/50459] New: alignof doesn't work on plain old constant, works with expressions containing it b.r.longbons at gmail dot com
` (2 preceding siblings ...)
2014-04-14 12:51 ` mpolacek at gcc dot gnu.org
@ 2014-05-09 8:25 ` mpolacek at gcc dot gnu.org
2014-05-09 8:26 ` mpolacek at gcc dot gnu.org
2014-11-21 13:30 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-09 8:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50459
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Fri May 9 08:24:37 2014
New Revision: 210262
URL: http://gcc.gnu.org/viewcvs?rev=210262&root=gcc&view=rev
Log:
PR c/50459
c-family/
* c-common.c (check_user_alignment): Return -1 if alignment is error
node.
(handle_aligned_attribute): Don't call default_conversion on
FUNCTION_DECLs.
(handle_vector_size_attribute): Likewise.
(handle_tm_wrap_attribute): Handle case when wrap_decl is error node.
(handle_sentinel_attribute): Call default_conversion and allow even
integral types as an argument.
c/
* c-parser.c (c_parser_attributes): Parse the arguments as an
expression-list if the attribute takes identifier.
testsuite/
* c-c++-common/attributes-1.c: Move test line to a new test.
* c-c++-common/attributes-2.c: New test.
* c-c++-common/pr50459.c: New test.
* c-c++-common/pr59280.c: Add "undeclared" to dg-error.
* gcc.dg/nonnull-2.c: Likewise.
* gcc.dg/pr55570.c: Modify dg-error.
* gcc.dg/tm/wrap-2.c: Likewise.
Added:
trunk/gcc/testsuite/c-c++-common/attributes-2.c
trunk/gcc/testsuite/c-c++-common/pr50459.c
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-parser.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/attributes-1.c
trunk/gcc/testsuite/c-c++-common/pr59280.c
trunk/gcc/testsuite/gcc.dg/nonnull-2.c
trunk/gcc/testsuite/gcc.dg/pr55570.c
trunk/gcc/testsuite/gcc.dg/tm/wrap-2.c
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50459] alignof doesn't work on plain old constant, works with expressions containing it
2011-09-20 5:20 [Bug c/50459] New: alignof doesn't work on plain old constant, works with expressions containing it b.r.longbons at gmail dot com
` (3 preceding siblings ...)
2014-05-09 8:25 ` mpolacek at gcc dot gnu.org
@ 2014-05-09 8:26 ` mpolacek at gcc dot gnu.org
2014-11-21 13:30 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-09 8:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50459
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50459] alignof doesn't work on plain old constant, works with expressions containing it
2011-09-20 5:20 [Bug c/50459] New: alignof doesn't work on plain old constant, works with expressions containing it b.r.longbons at gmail dot com
` (4 preceding siblings ...)
2014-05-09 8:26 ` mpolacek at gcc dot gnu.org
@ 2014-11-21 13:30 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-11-21 13:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50459
Bug 50459 depends on bug 61137, which changed state.
Bug 61137 Summary: [5 regression] FAIL: gcc.target/ia64/small-addr-1.c (test for excess errors)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61137
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-11-21 13:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-20 5:20 [Bug c/50459] New: alignof doesn't work on plain old constant, works with expressions containing it b.r.longbons at gmail dot com
2014-04-12 8:51 ` [Bug c/50459] " glisse at gcc dot gnu.org
2014-04-14 11:55 ` mpolacek at gcc dot gnu.org
2014-04-14 12:51 ` mpolacek at gcc dot gnu.org
2014-05-09 8:25 ` mpolacek at gcc dot gnu.org
2014-05-09 8:26 ` mpolacek at gcc dot gnu.org
2014-11-21 13:30 ` jakub at gcc dot gnu.org
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).