public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR 94044] ICE with sizeof & argument pack
@ 2020-03-20 15:41 Nathan Sidwell
  2020-03-22 18:26 ` Jim Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Sidwell @ 2020-03-20 15:41 UTC (permalink / raw)
  To: GCC Patches, Jim Wilson, kito.cheng

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

Thanks to Jim for figuring out how to reproduce the problem, I was able 
to apply pr94044-jig.diff to poorly hash the specialization table. (That 
places all the specializations of a particular template in the same 
bucket, forcing us to compare the arguments.)

The testcase creates sizeof_exprs containing argument packs, and we can 
no longer use same_type_p on those.

I did think this was going to be whack-a-mole, but bootstrapping & 
testing with the poor hash function, found no other cases.  Hurrah!

If it could be tested on arm &| riscv, that'd be additional verification.

nathan

-- 
Nathan Sidwell

[-- Attachment #2: pr94044.diff --]
[-- Type: text/x-patch, Size: 629 bytes --]

2020-03-20  Nathan Sidwell  <nathan@acm.org>

	PR c++/94044
	* tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
	operand.

diff --git i/gcc/cp/tree.c w/gcc/cp/tree.c
index da2e7fdcca3..b85967e1bfa 100644
--- i/gcc/cp/tree.c
+++ w/gcc/cp/tree.c
@@ -3802,9 +3802,13 @@ cp_tree_equal (tree t1, tree t2)
 	    if (SIZEOF_EXPR_TYPE_P (t2))
 	      o2 = TREE_TYPE (o2);
 	  }
+
 	if (TREE_CODE (o1) != TREE_CODE (o2))
 	  return false;
-	if (TYPE_P (o1))
+
+	if (ARGUMENT_PACK_P (o1))
+	  return template_args_equal (o1, o2);
+	else if (TYPE_P (o1))
 	  return same_type_p (o1, o2);
 	else
 	  return cp_tree_equal (o1, o2);

[-- Attachment #3: pr94044-jig.diff --]
[-- Type: text/x-patch, Size: 498 bytes --]

diff --git i/gcc/cp/pt.c w/gcc/cp/pt.c
index 03a8dfbd37c..d8544d66ca5 100644
--- i/gcc/cp/pt.c
+++ w/gcc/cp/pt.c
@@ -1724,7 +1724,12 @@ static hashval_t
 hash_tmpl_and_args (tree tmpl, tree args)
 {
   hashval_t val = iterative_hash_object (DECL_UID (tmpl), 0);
-  return iterative_hash_template_arg (args, val);
+#if 0
+  val = iterative_hash_template_arg (args, val);
+#else
+  (void) args;
+#endif
+  return val;
 }
 
 /* Returns a hash for a spec_entry node based on the TMPL and ARGS members,

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

* Re: [PR 94044] ICE with sizeof & argument pack
  2020-03-20 15:41 [PR 94044] ICE with sizeof & argument pack Nathan Sidwell
@ 2020-03-22 18:26 ` Jim Wilson
  2020-03-23  9:36   ` Kito Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Jim Wilson @ 2020-03-22 18:26 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: GCC Patches, Kito Cheng

On Fri, Mar 20, 2020 at 8:41 AM Nathan Sidwell <nathan@acm.org> wrote:
> If it could be tested on arm &| riscv, that'd be additional verification.

I did riscv testing, both cross and native, and didn't see any new
problems with the patch.

Jim

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

* Re: [PR 94044] ICE with sizeof & argument pack
  2020-03-22 18:26 ` Jim Wilson
@ 2020-03-23  9:36   ` Kito Cheng
  2020-03-23 10:43     ` Nathan Sidwell
  0 siblings, 1 reply; 4+ messages in thread
From: Kito Cheng @ 2020-03-23  9:36 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Nathan Sidwell, GCC Patches

Hi Nathan:

Tested variadic-sizeof4.C on x86, x86_64 with native compiler
Tested  variadic-sizeof4.C on aarch64, arm-eabi, riscv32, riscv64,
mips, mips64 and nds32 with cross compiler.

And tested g++/dg.exp on arm-eabi with this patch, no new fail introduced.


On Mon, Mar 23, 2020 at 2:27 AM Jim Wilson <jimw@sifive.com> wrote:
>
> On Fri, Mar 20, 2020 at 8:41 AM Nathan Sidwell <nathan@acm.org> wrote:
> > If it could be tested on arm &| riscv, that'd be additional verification.
>
> I did riscv testing, both cross and native, and didn't see any new
> problems with the patch.
>
> Jim

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

* Re: [PR 94044] ICE with sizeof & argument pack
  2020-03-23  9:36   ` Kito Cheng
@ 2020-03-23 10:43     ` Nathan Sidwell
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2020-03-23 10:43 UTC (permalink / raw)
  To: Kito Cheng, Jim Wilson; +Cc: GCC Patches

On 3/23/20 5:36 AM, Kito Cheng wrote:
> Hi Nathan:
> 
> Tested variadic-sizeof4.C on x86, x86_64 with native compiler
> Tested  variadic-sizeof4.C on aarch64, arm-eabi, riscv32, riscv64,
> mips, mips64 and nds32 with cross compiler.
> 
> And tested g++/dg.exp on arm-eabi with this patch, no new fail introduced.
> 
> 
> On Mon, Mar 23, 2020 at 2:27 AM Jim Wilson <jimw@sifive.com> wrote:
>>
>> On Fri, Mar 20, 2020 at 8:41 AM Nathan Sidwell <nathan@acm.org> wrote:
>>> If it could be tested on arm &| riscv, that'd be additional verification.
>>
>> I did riscv testing, both cross and native, and didn't see any new
>> problems with the patch.
>>

Thanks for checking guys.  Committed.

nathan

-- 
Nathan Sidwell

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

end of thread, other threads:[~2020-03-23 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 15:41 [PR 94044] ICE with sizeof & argument pack Nathan Sidwell
2020-03-22 18:26 ` Jim Wilson
2020-03-23  9:36   ` Kito Cheng
2020-03-23 10:43     ` Nathan Sidwell

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