Bug 83086 - [8 Regression] valgrind error in gimple-ssa-store-merging.c for recent build
Summary: [8 Regression] valgrind error in gimple-ssa-store-merging.c for recent build
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 8.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-21 10:36 UTC by David Binderman
Modified: 2017-11-21 14:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-11-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2017-11-21 10:36:00 UTC
I tried a valgrind build of recent gcc trunk with -O3 and got this:

==26140== Conditional jump or move depends on uninitialised value(s)
==26140==    at 0x145D303: (anonymous namespace)::imm_store_chain_info::try_coalesce_bswap((anonymous namespace)::merged_store_group*, unsigned int, unsigned int) (gimple-ssa-store-merging.c:2393)
==26140==    by 0x146390F: coalesce_immediate_stores (gimple-ssa-store-merging.c:2575)
==26140==    by 0x146390F: terminate_and_process_chain (gimple-ssa-store-merging.c:3726)

Source code is

254948      jakub       if (n.base_addr && vuse_store)

Configure is

../trunk/configure --prefix=/home/dcb/gcc/results.254990.valgrind \
	--disable-bootstrap \
	--disable-multilib \
	--disable-werror \
	--enable-checking=valgrind \
	--enable-languages=c,c++,fortran

sed 's/-O2/-O3 -funroll-loops -Wtautological-compare/' < Makefile > Makefile.tmp
mv Makefile.tmp Makefile
Comment 1 Jakub Jelinek 2017-11-21 11:10:33 UTC
On which source file it is?  Can you attach it preprocessed + full command line?
Comment 2 Jakub Jelinek 2017-11-21 11:14:32 UTC
Actually no need, I see what's going on.
Comment 3 Jakub Jelinek 2017-11-21 11:16:09 UTC
Untested fix:

2017-11-21  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/83086
	* gimple-ssa-store-merging.c
	(imm_store_chain_info::try_coalesce_bswap): Test this_n.base_addr
	rather than n.base_addr.

--- gcc/gimple-ssa-store-merging.c.jj	2017-11-21 09:41:00.000000000 +0100
+++ gcc/gimple-ssa-store-merging.c	2017-11-21 12:13:23.346947756 +0100
@@ -2390,7 +2390,7 @@ imm_store_chain_info::try_coalesce_bswap
 			    ? try_size - info->bitsize - bitpos
 			    : bitpos))
 	return false;
-      if (n.base_addr && vuse_store)
+      if (this_n.base_addr && vuse_store)
 	{
 	  unsigned int j;
 	  for (j = first; j <= last; ++j)
Comment 4 Jakub Jelinek 2017-11-21 13:54:39 UTC
Author: jakub
Date: Tue Nov 21 13:54:08 2017
New Revision: 255002

URL: https://gcc.gnu.org/viewcvs?rev=255002&root=gcc&view=rev
Log:
	PR tree-optimization/83086
	* gimple-ssa-store-merging.c
	(imm_store_chain_info::try_coalesce_bswap): Test this_n.base_addr
	rather than n.base_addr.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-ssa-store-merging.c
Comment 5 Richard Biener 2017-11-21 14:22:18 UTC
Fixed.