public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58170] New: Crash when aliasing a template class that is a member of its template base class.
@ 2013-08-15 19:38 cassio.neri at gmail dot com
  2014-02-15  2:33 ` [Bug c++/58170] [4.7/4.8/4.9 Regression] [c++11] " reichelt at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: cassio.neri at gmail dot com @ 2013-08-15 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58170
           Summary: Crash when aliasing a template class that is a member
                    of its template base class.
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cassio.neri at gmail dot com

The code below crashes gcc 4.8.1 (coincidentaly, it also crashes clang 3.3).

---------------------------------------------------------------------

template <typename T, typename U>
struct base {

  template <typename V>
  struct derived;

};

template <typename T, typename U>
template <typename V>
struct base<T, U>::derived : public base<T, V> {
};

// This (wrong?) alias declaration provoques the crash.
template <typename T, typename U, typename V>
using derived = base<T, U>::derived<V>;

// This one works:
// template <typename T, typename U, typename V>
// using derived = typename base<T, U>::template derived<V>;

template <typename T>
void f() {
  derived<T, bool, char> m{};
  (void) m;
}

int main() {
  f<int>();
}

---------------------------------------------------------------------

$ g++ -v -save-temps -std=c++11 -Wall -pedantic main.cpp 
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-4.8-20130725/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl
--disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default
--enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu
--disable-install-libiberty --disable-multilib --disable-libssp
--disable-werror --enable-checking=release
Thread model: posix
gcc version 4.8.1 20130725 (prerelease) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-Wall' '-Wpedantic'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus -E -quiet -v -D_GNU_SOURCE
main.cpp -mtune=generic -march=x86-64 -std=c++11 -Wall -Wpedantic
-fpch-preprocess -o main.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/x86_64-unknown-linux-gnu

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include
 /usr/local/include
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-Wall' '-Wpedantic'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus -fpreprocessed main.ii
-quiet -dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase main -Wall
-Wpedantic -std=c++11 -version -o main.s
GNU C++ (GCC) version 4.8.1 20130725 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.1 20130725 (prerelease), GMP version
5.1.2, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.8.1 20130725 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.1 20130725 (prerelease), GMP version
5.1.2, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: fcec9480bd3d120c7e8d40d79394317d
main.cpp: In substitution of ‘template<class T, class U, class V> using derived
= base<T, U>::derived<V> [with T = T; U = bool; V = char]’:
main.cpp:24:24:   required from here
main.cpp:16:39: internal compiler error: Segmentation fault
 using derived = base<T, U>::derived<V>;
                                       ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
>From gcc-bugs-return-427900-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Aug 15 23:31:52 2013
Return-Path: <gcc-bugs-return-427900-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5783 invoked by alias); 15 Aug 2013 23:31:52 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 5736 invoked by uid 48); 15 Aug 2013 23:31:50 -0000
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/58113] [4.9 Regression] gfortran.dg/round_4.f90 FAILs
Date: Thu, 15 Aug 2013 23:31:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: kargl at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-58113-4-KEMRHCk0j2@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58113-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58113-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-08/txt/msg00824.txt.bz2
Content-length: 959

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX113

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
round_4.f90 fails on x86_64-unknown-freebsd10.0.

Reduce testcase

program main

  use iso_fortran_env

  implicit none

  real(4) :: r4p, r4m, ref4u, ref4d
  character(len ) :: str, round

  ref4u = 0.100000001_4
  ref4d = nearest (ref4u, -1.0_4)

  round = 'up'
  call t()
  print '(4Z10)', r4p, ref4u, r4m, -ref4d

contains
  subroutine t()
    str = "0.1 0.1 0.1 0.1"
    read(str, *,round=round) r4p, r8p, r10p, r16p
    str = "-0.1 -0.1 -0.1 -0.1"
    read(str, *,round=round) r4m, r8m, r10m, r16m
  end subroutine t
end program main

% gfc4x -o z round_4.f90 && ./z
  3DCCCCCD  3DCCCCCD  BDCCCCCD  BDCCCCCC


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

end of thread, other threads:[~2015-01-13 17:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-15 19:38 [Bug c++/58170] New: Crash when aliasing a template class that is a member of its template base class cassio.neri at gmail dot com
2014-02-15  2:33 ` [Bug c++/58170] [4.7/4.8/4.9 Regression] [c++11] " reichelt at gcc dot gnu.org
2014-02-15  2:36 ` reichelt at gcc dot gnu.org
2014-02-21 21:00 ` jason at gcc dot gnu.org
2014-02-22  5:50 ` jason at gcc dot gnu.org
2014-02-22  5:57 ` [Bug c++/58170] [4.7/4.8 " jason at gcc dot gnu.org
2014-06-12 13:41 ` rguenth at gcc dot gnu.org
2014-12-10 12:45 ` [Bug c++/58170] [4.8 " rguenth at gcc dot gnu.org
2014-12-19 13:24 ` jakub at gcc dot gnu.org
2015-01-13 17:24 ` 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).