This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix UB in dse.c (PR rtl-optimization/85431)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]