public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53586] New: Internal compiler errors on cp/pt.c:12077 and expr.c:9147
@ 2012-06-06  5:07 paulotorrens at gnu dot org
  2012-06-06  5:58 ` [Bug c++/53586] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: paulotorrens at gnu dot org @ 2012-06-06  5:07 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53586
           Summary: Internal compiler errors on cp/pt.c:12077 and
                    expr.c:9147
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: paulotorrens@gnu.org


Trying to compile this small function:

template<typename T> auto ptr2bitmap(T *bitmap, int width, int depth = 3) ->
typeof(typeof(unsigned char[depth])[width]) *{
  return bitmap;
};

I got this:

Compiling `mjpeg.cpp'...
mjpeg.cpp: In substitution of 'template<class T> unsigned char (*
ptr2bitmap(T*, int, int))[width][depth] [with T = void]':
mjpeg.cpp:223:39:   required from here
mjpeg.cpp:200:27: internal compiler error: in tsubst_copy, at cp/pt.c:12077
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://trac.macports.org/newticket> for instructions.
make: *** [mjpeg.o] Error 1







And, trying to compile this code:

      using uc3 = unsigned char[3];
      using uc3w = uc3[width];
      using uc3wp = uc3w *;
      auto img = (uc3wp)rgb;


      int w = 0;
      for(w = 0; w < font_GMT_width; w++) {
        for(int y = 0; y < font_height; y++) {

          ((img[y])[w])[0] = font_pixel(font_GMTX + w, y, 0);
          ((img[y])[w])[1] = font_pixel(font_GMTX + w, y, 1);
          ((img[y])[w])[2] = font_pixel(font_GMTX + w, y, 2);

        };
      };
      auto add = [&](int start) {
        for(int x = 0; x < font_char_width; x++, w++) {
          for(int y = 0; y < font_height; y++) {
            ((img[y])[w + x])[0] = font_pixel(start + x, y, 0);
            ((img[y])[w + x])[1] = font_pixel(start + x, y, 1);
            ((img[y])[w + x])[2] = font_pixel(start + x, y, 2);
          };
        };
      };
      auto add_colon = [&] {
        add(font_ColonX);
      };
      auto add_slash = [&] {
        add(font_SlashX);
      };


I got this:

mjpeg.cpp: In static member function 'static void
std::_Function_handler<void(_ArgTypes ...), _Functor>::_M_invoke(const
std::_Any_data&, _ArgTypes ...) [with _Functor = MJPEG::Video::addJpg(void*,
size_t, double, tm*) const::<lambda(void*, size_t, size_t)>; _ArgTypes =
{void*, long unsigned int, long unsigned int}]':
mjpeg.cpp:228:20: internal compiler error: in expand_expr_real_1, at
expr.c:9147
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://trac.macports.org/newticket> for instructions.
make: *** [mjpeg.o] Error 1





All tests were run on a Mac OS X Lion machine, and GCC as configured as follow:
../gcc-4.7.0/configure --prefix=/opt/local --build=x86_64-apple-darwin11
--enable-languages=c,c++,objc,obj-c++,lto,fortran,java
--libdir=/opt/local/lib/gcc47 --includedir=/opt/local/include/gcc47
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local
--with-local-prefix=/opt/local --with-system-zlib --disable-nls
--program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/c++/
--with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local
--with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl
--enable-stage1-checking --disable-multilib --enable-lto
--with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld
--with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket
--with-pkgversion='MacPorts gcc47 4.7.0_3'


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

* [Bug c++/53586] Internal compiler errors on cp/pt.c:12077 and expr.c:9147
  2012-06-06  5:07 [Bug c++/53586] New: Internal compiler errors on cp/pt.c:12077 and expr.c:9147 paulotorrens at gnu dot org
@ 2012-06-06  5:58 ` pinskia at gcc dot gnu.org
  2012-06-06 18:43 ` paulotorrens at gnu dot org
  2013-08-09 19:29 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-06-06  5:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-06-06 05:58:39 UTC ---
What happens if you use decltype instead of typeof ?


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

* [Bug c++/53586] Internal compiler errors on cp/pt.c:12077 and expr.c:9147
  2012-06-06  5:07 [Bug c++/53586] New: Internal compiler errors on cp/pt.c:12077 and expr.c:9147 paulotorrens at gnu dot org
  2012-06-06  5:58 ` [Bug c++/53586] " pinskia at gcc dot gnu.org
@ 2012-06-06 18:43 ` paulotorrens at gnu dot org
  2013-08-09 19:29 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paulotorrens at gnu dot org @ 2012-06-06 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paulo Torrens <paulotorrens at gnu dot org> 2012-06-06 18:43:13 UTC ---
(In reply to comment #1)
> What happens if you use decltype instead of typeof ?



template<typename T> auto ptr2bitmap(T *bitmap, int width, int depth = 3) ->
decltype(decltype(unsigned char[depth])[width]) *{
  return bitmap;
};

int main() {
  void *x;
  auto a = ptr2bitmap(x, 100);
};


test.cpp:2:10: error: expected primary-expression before 'decltype'
test.cpp:2:10: error: expected ')' before 'decltype'
test.cpp:2:1: error: expected type-specifier before 'decltype'
test.cpp:2:1: error: expected initializer before 'decltype'







And without decltype and typeof at all:


template<typename T> auto ptr2bitmap(T *bitmap, int width, int depth = 3) ->
unsigned char[depth][width] *{
  return bitmap;
};

int main() {
  void *x;
  auto a = ptr2bitmap(x, 100);
};




test.cpp:2:15: error: use of parameter 'depth' outside function body
test.cpp:2:22: error: use of parameter 'width' outside function body
test.cpp:2:29: error: expected initializer before '*' token


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

* [Bug c++/53586] Internal compiler errors on cp/pt.c:12077 and expr.c:9147
  2012-06-06  5:07 [Bug c++/53586] New: Internal compiler errors on cp/pt.c:12077 and expr.c:9147 paulotorrens at gnu dot org
  2012-06-06  5:58 ` [Bug c++/53586] " pinskia at gcc dot gnu.org
  2012-06-06 18:43 ` paulotorrens at gnu dot org
@ 2013-08-09 19:29 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-09 19:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.8.1, 4.9.0
         Resolution|---                         |FIXED

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
No ICEs with current mainline and 4_8-branch.


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

end of thread, other threads:[~2013-08-09 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-06  5:07 [Bug c++/53586] New: Internal compiler errors on cp/pt.c:12077 and expr.c:9147 paulotorrens at gnu dot org
2012-06-06  5:58 ` [Bug c++/53586] " pinskia at gcc dot gnu.org
2012-06-06 18:43 ` paulotorrens at gnu dot org
2013-08-09 19:29 ` 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).