public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34624]  New: valid c++ code doesn't compile for x86_64, but for i386
@ 2007-12-30 13:27 tim at klingt dot org
  2008-01-13  2:34 ` [Bug c++/34624] " bangerth at dealii dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: tim at klingt dot org @ 2007-12-30 13:27 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

the following code compiles on i386, but not for x86_64:

tim@laptop:~$ g++ -m32 bug.cpp 
tim@laptop:~$ 
tim@laptop:~$ g++ -m64 bug.cpp 
bug.cpp: In function ‘int main()’:
bug.cpp:69: error: no matching function for call to
‘get_samples(my_table<float, 1024u>&)’
tim@laptop:~$ 

#include <boost/array.hpp>

typedef unsigned int uint;

template<typename sampletype, uint size>
struct my_table:
    public boost::array<sampletype, size>
{};

template<typename sampletype, uint size>
inline const sampletype * get_samples(boost::array<sampletype, size> const &
buffer)
{
    return buffer.begin();
}

int main()
{
    my_table<float, 1024> tab;
    const float * ptr = get_samples(tab);
}


i could reproduce it with the debian packages of gcc-4.1 and 4.2 on i386 and
amd64. 

best, tim


-- 
           Summary: valid c++ code doesn't compile for x86_64, but for i386
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim at klingt dot org


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


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

* [Bug c++/34624] valid c++ code doesn't compile for x86_64, but for i386
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
@ 2008-01-13  2:34 ` bangerth at dealii dot org
  2008-01-13 13:03 ` tim at klingt dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2008-01-13  2:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bangerth at dealii dot org  2008-01-13 02:23 -------
Can you try to reduce this to something smaller that doesn't require
boost?


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org


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


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

* [Bug c++/34624] valid c++ code doesn't compile for x86_64, but for i386
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
  2008-01-13  2:34 ` [Bug c++/34624] " bangerth at dealii dot org
@ 2008-01-13 13:03 ` tim at klingt dot org
  2008-01-14  9:33 ` Ralf dot Wildenhues at gmx dot de
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: tim at klingt dot org @ 2008-01-13 13:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tim at klingt dot org  2008-01-13 12:38 -------
... i tried when reporting the bug ... however i haven't really been able
create a stripped down version ...

the problem also occurs when using std::tr1::array instead of boost::array,
though ...


-- 


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


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

* [Bug c++/34624] valid c++ code doesn't compile for x86_64, but for i386
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
  2008-01-13  2:34 ` [Bug c++/34624] " bangerth at dealii dot org
  2008-01-13 13:03 ` tim at klingt dot org
@ 2008-01-14  9:33 ` Ralf dot Wildenhues at gmx dot de
  2008-01-14 11:18 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Ralf dot Wildenhues at gmx dot de @ 2008-01-14  9:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from Ralf dot Wildenhues at gmx dot de  2008-01-14 07:42 -------
This fails with both -m32 and -m64 (but I'm not quite sure if it
still reproduces the original issue):


typedef unsigned long size_t;
template<typename _Tp, size_t _Nm = 1> struct array { };
template<typename sampletype, unsigned int size>
struct my_table: public array<sampletype, size> { };

template<typename sampletype, unsigned int size>
inline const sampletype *
get_samples(array<sampletype, size> const & buffer) {
  return buffer.begin();
}
int main() {
  my_table<float, 1024> tab;
  const float * ptr = get_samples(tab);
}


-- 

Ralf dot Wildenhues at gmx dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Ralf dot Wildenhues at gmx
                   |                            |dot de


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


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

* [Bug c++/34624] valid c++ code doesn't compile for x86_64, but for i386
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
                   ` (2 preceding siblings ...)
  2008-01-14  9:33 ` Ralf dot Wildenhues at gmx dot de
@ 2008-01-14 11:18 ` rguenth at gcc dot gnu dot org
  2008-09-22 12:12 ` tim at klingt dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-14 11:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2008-01-14 10:50 -------
EDG says

t.ii(13): error: no instance of function template "get_samples" matches the
argument list
            argument types are: (my_table<float, 1024U>)
    const float * ptr = get_samples(tab);
                        ^

compilation aborted for t.ii (code 2)

for the testcase in comment #3.


-- 


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


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

* [Bug c++/34624] valid c++ code doesn't compile for x86_64, but for i386
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
                   ` (3 preceding siblings ...)
  2008-01-14 11:18 ` rguenth at gcc dot gnu dot org
@ 2008-09-22 12:12 ` tim at klingt dot org
  2008-12-30  5:42 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: tim at klingt dot org @ 2008-09-22 12:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tim at klingt dot org  2008-09-22 12:11 -------
i have the same issue with both gcc-4.3 and gcc-4.4 ... 


-- 


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


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

* [Bug c++/34624] valid c++ code doesn't compile for x86_64, but for i386
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
                   ` (4 preceding siblings ...)
  2008-09-22 12:12 ` tim at klingt dot org
@ 2008-12-30  5:42 ` pinskia at gcc dot gnu dot org
  2008-12-30 10:00 ` tim at klingt dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-30  5:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-12-30 05:39 -------
Can you attach the preprocessed source for the -m64 case?


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug c++/34624] valid c++ code doesn't compile for x86_64, but for i386
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
                   ` (5 preceding siblings ...)
  2008-12-30  5:42 ` pinskia at gcc dot gnu dot org
@ 2008-12-30 10:00 ` tim at klingt dot org
  2008-12-30 10:00 ` tim at klingt dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: tim at klingt dot org @ 2008-12-30 10:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from tim at klingt dot org  2008-12-30 09:58 -------
Created an attachment (id=17009)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17009&action=view)
preprocessed source


-- 


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


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

* [Bug c++/34624] valid c++ code doesn't compile for x86_64, but for i386
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
                   ` (6 preceding siblings ...)
  2008-12-30 10:00 ` tim at klingt dot org
@ 2008-12-30 10:00 ` tim at klingt dot org
  2008-12-30 10:03 ` tim at klingt dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: tim at klingt dot org @ 2008-12-30 10:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from tim at klingt dot org  2008-12-30 09:59 -------
Created an attachment (id=17010)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17010&action=view)
preprocessed source with -m32


-- 


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


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

* [Bug c++/34624] valid c++ code doesn't compile for x86_64, but for i386
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
                   ` (7 preceding siblings ...)
  2008-12-30 10:00 ` tim at klingt dot org
@ 2008-12-30 10:03 ` tim at klingt dot org
  2008-12-30 17:29 ` [Bug c++/34624] templated code is rejected different type in nontype template argument pinskia at gcc dot gnu dot org
  2008-12-30 17:31 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 13+ messages in thread
From: tim at klingt dot org @ 2008-12-30 10:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from tim at klingt dot org  2008-12-30 10:00 -------
(In reply to comment #8)
> Created an attachment (id=17010)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17010&action=view) [edit]
> preprocessed source with -m32
> 

(In reply to comment #7)
> Created an attachment (id=17009)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17009&action=view) [edit]
> preprocessed source
> 

both preprocessed sources have been generated with gcc-4.4:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../gcc-4.4-20081226/configure -v
--with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs
--enable-languages=c,c++ --prefix=/usr/local/lib/gcc-snapshot --enable-shared
--with-system-zlib --disable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-gtk-cairo --disable-plugin --enable-objc-gc --enable-mpfr
--disable-werror --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.0 20081226 (experimental) (GCC) 


-- 

tim at klingt dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED


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


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

* [Bug c++/34624] templated code is rejected different type in nontype template argument
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
                   ` (8 preceding siblings ...)
  2008-12-30 10:03 ` tim at klingt dot org
@ 2008-12-30 17:29 ` pinskia at gcc dot gnu dot org
  2008-12-30 17:31 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-30 17:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2008-12-30 17:25 -------
Here is a reduced testcase which is rejected for both -m32 and -m64:
typedef unsigned long size_t;

template <typename t, size_t len>   class array {};

typedef unsigned int uint;

template<typename sampletype, uint size>
struct my_table: array<sampletype, size> {};

template<typename sampletype, uint size>
inline const sampletype * get_samples(array<sampletype, size> const &buffer) {
}

int main()
{
  my_table<float, 1024> tab;
  const float * ptr = get_samples(tab);
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|valid c++ code doesn't      |templated code is rejected
                   |compile for x86_64, but for |different type in nontype
                   |i386                        |template argument


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


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

* [Bug c++/34624] templated code is rejected different type in nontype template argument
  2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
                   ` (9 preceding siblings ...)
  2008-12-30 17:29 ` [Bug c++/34624] templated code is rejected different type in nontype template argument pinskia at gcc dot gnu dot org
@ 2008-12-30 17:31 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-30 17:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2008-12-30 17:27 -------
>but I'm not quite sure if it still reproduces the original issue

Yes it does, I had missed your reduced testcase before.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
      Known to fail|                            |3.3 4.0.1 4.3.3 4.4.0


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


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

* [Bug c++/34624] templated code is rejected different type in nontype template argument
       [not found] <bug-34624-4@http.gcc.gnu.org/bugzilla/>
@ 2013-08-01 10:43 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-01 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|gcc-bugs at gcc dot gnu.org        |
         Resolution|---                         |INVALID
      Known to fail|                            |

--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Closing.


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

end of thread, other threads:[~2013-08-01 10:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-30 13:27 [Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386 tim at klingt dot org
2008-01-13  2:34 ` [Bug c++/34624] " bangerth at dealii dot org
2008-01-13 13:03 ` tim at klingt dot org
2008-01-14  9:33 ` Ralf dot Wildenhues at gmx dot de
2008-01-14 11:18 ` rguenth at gcc dot gnu dot org
2008-09-22 12:12 ` tim at klingt dot org
2008-12-30  5:42 ` pinskia at gcc dot gnu dot org
2008-12-30 10:00 ` tim at klingt dot org
2008-12-30 10:00 ` tim at klingt dot org
2008-12-30 10:03 ` tim at klingt dot org
2008-12-30 17:29 ` [Bug c++/34624] templated code is rejected different type in nontype template argument pinskia at gcc dot gnu dot org
2008-12-30 17:31 ` pinskia at gcc dot gnu dot org
     [not found] <bug-34624-4@http.gcc.gnu.org/bugzilla/>
2013-08-01 10:43 ` paolo.carlini at oracle dot com

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