public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36979]  New: 'sizeof' wrong when using typedef ... __attribute__((mode(*I))) in a template
@ 2008-07-31  6:31 cyp561 at gmail dot com
  2008-08-10 23:21 ` [Bug c++/36979] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: cyp561 at gmail dot com @ 2008-07-31  6:31 UTC (permalink / raw)
  To: gcc-bugs

This doesn't work: g++-4.3.1
These work: g++-3.4.6 g++-4.1.2 g++-4.2.4

$ g++-4.3.1 -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.1
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.1
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.1/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.1/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --enable-secureplt --enable-multilib --enable-libmudflap
--disable-libssp --enable-cld --enable-java-awt=gtk --enable-objc-gc
--enable-languages=c,c++,java,objc,obj-c++,treelang,fortran --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.3.1-r1 p1.1'
Thread model: posix
gcc version 4.3.1 (Gentoo 4.3.1-r1 p1.1)


Same results in 4.3.1 with -O2/-O0 and with/without -m32.
I get the size of unsigned, instead of the size of mode(*I).

---

extern "C" void abort();

template<class unused>
void function()
{
    typedef unsigned uint8_t __attribute__((mode(QI)));
    typedef unsigned uint16_t __attribute__((mode(HI)));
    typedef unsigned uint32_t __attribute__((mode(SI)));
    typedef unsigned uint64_t __attribute__((mode(DI)));
    //typedef unsigned uint128_t __attribute__((mode(TI)));
    if(sizeof(uint8_t)  != sizeof((uint8_t)0)  ||
       sizeof(uint16_t) != sizeof((uint16_t)0) ||
       sizeof(uint32_t) != sizeof((uint32_t)0) ||
       sizeof(uint64_t) != sizeof((uint64_t)0)
      )
        abort();
}

int main()
{
    function<char>();
}


-- 
           Summary: 'sizeof' wrong when using typedef ...
                    __attribute__((mode(*I))) in a template
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cyp561 at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36979


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/36979] 'sizeof' wrong when using typedef ... __attribute__((mode(*I))) in a template
  2008-07-31  6:31 [Bug c++/36979] New: 'sizeof' wrong when using typedef ... __attribute__((mode(*I))) in a template cyp561 at gmail dot com
@ 2008-08-10 23:21 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-10 23:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-08-10 23:20 -------
This was fixed with the patch that fixed PR 36662.

*** This bug has been marked as a duplicate of 36662 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |wrong-code
         Resolution|                            |DUPLICATE
   Target Milestone|---                         |4.3.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36979


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-10 23:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-31  6:31 [Bug c++/36979] New: 'sizeof' wrong when using typedef ... __attribute__((mode(*I))) in a template cyp561 at gmail dot com
2008-08-10 23:21 ` [Bug c++/36979] " pinskia at gcc dot gnu dot 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).