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

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