Bug 90966 - [9/10 Regression] ICE in tsubst_copy, at cp/pt.c:16155
Summary: [9/10 Regression] ICE in tsubst_copy, at cp/pt.c:16155
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.1.0
: P2 normal
Target Milestone: 9.3
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
: 92625 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-06-23 06:36 UTC by frankhb1989
Modified: 2020-02-20 22:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-06-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description frankhb1989 2019-06-23 06:36:58 UTC
template<typename I>
void f()
{
	using S = signed char;
	constexpr const S v[]{0};
}

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

a.cc: In instantiation of 'void f() [with I = int]':
a.cc:10:9:   required from here
a.cc:5:20: internal compiler error: in tsubst_copy, at cp/pt.c:16155
    5 |  constexpr const S v[]{0};
      |                    ^
Comment 1 Marek Polacek 2019-06-23 15:46:02 UTC
Confirmed.
Comment 2 Marek Polacek 2019-06-23 15:49:11 UTC
Started with r263511.
Comment 3 Jakub Jelinek 2019-08-12 08:53:21 UTC
GCC 9.2 has been released.
Comment 4 GCC Commits 2020-01-27 20:04:31 UTC
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:8f25c39c454d7d3d323edf014a653649946352bd

commit r10-6266-g8f25c39c454d7d3d323edf014a653649946352bd
Author: Jason Merrill <jason@redhat.com>
Date:   Sun Jan 26 22:19:47 2020 -0500

    c++: Fix array of char typedef in template (PR90966).
    
    Since Martin Sebor's patch for PR 71625 to change braced array initializers
    to STRING_CST in some cases, we need to be ready for STRING_CST with types
    that are changed by tsubst.  fold_convert doesn't know how to deal with
    STRING_CST, which is reasonable; we really shouldn't expect it to here.  So
    let's handle STRING_CST separately.
    
    	PR c++/90966
    	* pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
Comment 5 GCC Commits 2020-01-28 14:54:14 UTC
The releases/gcc-9 branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:dcb23017b1a9f65a81dbbe0f2b1a42999f7b2ac7

commit r9-8184-gdcb23017b1a9f65a81dbbe0f2b1a42999f7b2ac7
Author: Jason Merrill <jason@redhat.com>
Date:   Sun Jan 26 22:19:47 2020 -0500

    c++: Fix array of char typedef in template (PR90966).
    
    Since Martin Sebor's patch for PR 71625 to change braced array initializers
    to STRING_CST in some cases, we need to be ready for STRING_CST with types
    that are changed by tsubst.  fold_convert doesn't know how to deal with
    STRING_CST, which is reasonable; we really shouldn't expect it to here.  So
    let's handle STRING_CST separately.
    
    	PR c++/90966
    	* pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
Comment 6 Jason Merrill 2020-02-04 20:01:03 UTC
*** Bug 92625 has been marked as a duplicate of this bug. ***
Comment 7 Marek Polacek 2020-02-20 22:33:36 UTC
Fixed for GCC 9.3 and 10.