This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix UB in dse.c (PR rtl-optimization/85431)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>, Jeff Law <law at redhat dot com>, Richard Sandiford <richard dot sandiford at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 17 Apr 2018 22:57:48 +0200
- Subject: [PATCH] Fix UB in dse.c (PR rtl-optimization/85431)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
As mentioned, for BLKmode stores with MEM_SIZE of 0 we invoke UB,
lowpart_bitmask (0) is called and that shifts an UHWI by 64.
Zero size MEMs should only appear in inline asm and shouldn't be interesting
to DSE at all, they can't make other stores dead, nor can be removed as dead
themselves.
Fixed by just ignoring them. Bootstrapped/regtested on x86_64-linux and
i686-linux, ok for trunk?
2018-04-17 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/85431
* dse.c (record_store): Ignore zero width stores.
--- gcc/dse.c.jj 2018-01-27 07:26:11.826913649 +0100
+++ gcc/dse.c 2018-04-17 17:53:55.019932700 +0200
@@ -1417,6 +1417,9 @@ record_store (rtx body, bb_info_t bb_inf
return 0;
}
+ if (known_eq (width, 0))
+ return 0;
+
if (group_id >= 0)
{
/* In the restrictive case where the base is a constant or the
Jakub