public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [testsuite] Remove undefined behavior from gcc.dg/tree-ssa/pr44306.c
@ 2023-09-25 12:17 Aldy Hernandez
  2023-09-25 14:33 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Aldy Hernandez @ 2023-09-25 12:17 UTC (permalink / raw)
  To: GCC patches; +Cc: Richard Biener, Andrew MacLeod, Aldy Hernandez

In auditing the DOM code to see what the scoped tables catch that
ranger doesn't, I've run accross this test, which seems to
have uninitialized reads from both j and present[].

From the original PR, it looks like this came from a reduction of a
failing test in SPEC's 464.h264ref.  A google search of the
CalculateQuant8Param() in the test yields:

https://github.com/microsoft/test-suite/blob/master/MultiSource/Applications/JM/lencod/q_matrix.c

Assuming the above source is similar to the original testcase, it looks
like both "j" and "present" were initialized before use, so our testcase
just got reduced a bit too far.

I tried to build the offending commit to see if my adjustments to the
test still caused it to fail:

commit e1449456c0a88f5b3122db5452f7e91f5a9535f6 (HEAD -> master)
Author: Sebastian Pop <sebastian.pop@amd.com>
Date:   Wed May 26 16:46:59 2010 +0000

    Reorganize the analysis of basic block predication.

...but alas it no longer builds with a recent compiler.  Perhaps
someone has a ./cc1 of that revision around to verify?

OK?

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/pr44306.c: Remove undefined behavior.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr44306.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr44306.c b/gcc/testsuite/gcc.dg/tree-ssa/pr44306.c
index 1ea04ce3a98..d322fe048b5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr44306.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr44306.c
@@ -8,10 +8,10 @@ int LevelScale8x8Luma_Inter[6][8][8];
 int InvLevelScale8x8Luma_Intra[6][8][8];
 int InvLevelScale8x8Luma_Inter[6][8][8];
 short UseDefaultScalingMatrix8x8Flag[2];
-void CalculateQuant8Param()
+int present[2];
+void CalculateQuant8Param(int j)
 {
- int i, j, k, temp;
- int present[2];
+ int i, k, temp;
  for(k=0; j<8; j++)
    for(i=0; i<8; i++)
      {
-- 
2.41.0


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

* Re: [PATCH] [testsuite] Remove undefined behavior from gcc.dg/tree-ssa/pr44306.c
  2023-09-25 12:17 [PATCH] [testsuite] Remove undefined behavior from gcc.dg/tree-ssa/pr44306.c Aldy Hernandez
@ 2023-09-25 14:33 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-09-25 14:33 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: GCC patches, Andrew MacLeod



> Am 25.09.2023 um 14:18 schrieb Aldy Hernandez <aldyh@redhat.com>:
> 
> In auditing the DOM code to see what the scoped tables catch that
> ranger doesn't, I've run accross this test, which seems to
> have uninitialized reads from both j and present[].
> 
> From the original PR, it looks like this came from a reduction of a
> failing test in SPEC's 464.h264ref.  A google search of the
> CalculateQuant8Param() in the test yields:
> 
> https://github.com/microsoft/test-suite/blob/master/MultiSource/Applications/JM/lencod/q_matrix.c
> 
> Assuming the above source is similar to the original testcase, it looks
> like both "j" and "present" were initialized before use, so our testcase
> just got reduced a bit too far.
> 
> I tried to build the offending commit to see if my adjustments to the
> test still caused it to fail:
> 
> commit e1449456c0a88f5b3122db5452f7e91f5a9535f6 (HEAD -> master)
> Author: Sebastian Pop <sebastian.pop@amd.com>
> Date:   Wed May 26 16:46:59 2010 +0000
> 
>    Reorganize the analysis of basic block predication.
> 
> ...but alas it no longer builds with a recent compiler.  Perhaps
> someone has a ./cc1 of that revision around to verify?
> 
> OK?

Ok


> gcc/testsuite/ChangeLog:
> 
>    * gcc.dg/tree-ssa/pr44306.c: Remove undefined behavior.
> ---
> gcc/testsuite/gcc.dg/tree-ssa/pr44306.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr44306.c b/gcc/testsuite/gcc.dg/tree-ssa/pr44306.c
> index 1ea04ce3a98..d322fe048b5 100644
> --- a/gcc/testsuite/gcc.dg/tree-ssa/pr44306.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr44306.c
> @@ -8,10 +8,10 @@ int LevelScale8x8Luma_Inter[6][8][8];
> int InvLevelScale8x8Luma_Intra[6][8][8];
> int InvLevelScale8x8Luma_Inter[6][8][8];
> short UseDefaultScalingMatrix8x8Flag[2];
> -void CalculateQuant8Param()
> +int present[2];
> +void CalculateQuant8Param(int j)
> {
> - int i, j, k, temp;
> - int present[2];
> + int i, k, temp;
>  for(k=0; j<8; j++)
>    for(i=0; i<8; i++)
>      {
> -- 
> 2.41.0
> 

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

end of thread, other threads:[~2023-09-25 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25 12:17 [PATCH] [testsuite] Remove undefined behavior from gcc.dg/tree-ssa/pr44306.c Aldy Hernandez
2023-09-25 14:33 ` Richard Biener

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