[Bug c++/92136] New: cc1plus segv with CTAD and -fchecking

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 17 13:59:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92136

            Bug ID: 92136
           Summary: cc1plus segv with CTAD and -fchecking
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

This testcase, provided by Pilar Latiesa:

template <typename T>
class Base {};

template <int d>
class Test : public Base<Test<d>>
{
public:
  Test() = default;

  template <template <int> typename T>
  Test(Base<T<d>> const &) {}
};

int main()
{
  Test<2> const eps;
  Test const omega = eps;
  Test const gamma = omega;

  return 0;
}

causes a segv.  We seem to loop infinitely:

#0  0x0000000000b953ee in structural_comptypes (
    t1=<error reading variable: Cannot access memory at address
0x7ffffbffeff8>, 
    t2=<error reading variable: Cannot access memory at address
0x7ffffbffeff0>, 
    strict=<error reading variable: Cannot access memory at address
0x7ffffbffefec>)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1236
#1  0x0000000000b96f7e in comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1497
#2  0x0000000000aa2181 in comp_template_parms (parms1=<tree_list
0x7ffff0f569b0>, 
    parms2=<tree_list 0x7ffff0f56f28>) at /home/marek/src/gcc/gcc/cp/pt.c:3289
#3  0x0000000000b95b71 in structural_comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1325
#4  0x0000000000b96f7e in comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1497
#5  0x0000000000aa2181 in comp_template_parms (parms1=<tree_list
0x7ffff0f569b0>, 
    parms2=<tree_list 0x7ffff0f56f28>) at /home/marek/src/gcc/gcc/cp/pt.c:3289
#6  0x0000000000b95b71 in structural_comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1325
#7  0x0000000000b96f7e in comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1497
#8  0x0000000000aa2181 in comp_template_parms (parms1=<tree_list
0x7ffff0f569b0>, 
    parms2=<tree_list 0x7ffff0f56f28>) at /home/marek/src/gcc/gcc/cp/pt.c:3289
#9  0x0000000000b95b71 in structural_comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1325
#10 0x0000000000b96f7e in comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1497
#11 0x0000000000aa2181 in comp_template_parms (parms1=<tree_list
0x7ffff0f569b0>, 
    parms2=<tree_list 0x7ffff0f56f28>) at /home/marek/src/gcc/gcc/cp/pt.c:3289
#12 0x0000000000b95b71 in structural_comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1325
#13 0x0000000000b96f7e in comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1497
#14 0x0000000000aa2181 in comp_template_parms (parms1=<tree_list
0x7ffff0f569b0>, 
    parms2=<tree_list 0x7ffff0f56f28>) at /home/marek/src/gcc/gcc/cp/pt.c:3289
#15 0x0000000000b95b71 in structural_comptypes (t1=<template_template_parm
0x7ffff0f5d738>, 
    t2=<template_template_parm 0x7ffff0f62000>, strict=0)
    at /home/marek/src/gcc/gcc/cp/typeck.c:1325
[...]


More information about the Gcc-bugs mailing list