Hi,

On Thu, Nov 20 2025, David Malcolm wrote:
> On Wed, 2025-11-19 at 15:54 +0100, Martin Jambor wrote:
>> Hello,
>> 
>> On Mon, Nov 10 2025, David Malcolm wrote:
>> > On Sat, 2025-11-08 at 00:12 +0100, Martin Jambor wrote:
>> > 
>> > [...snip...]
>> > 
>> > > diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-3.c
>> > > b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-3.c
>> > > new file mode 100644
>> > > index 00000000000..d45928e0a25
>> > > --- /dev/null
>> > > +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-3.c
>> > > @@ -0,0 +1,30 @@
>> > > +/* { dg-do link } */
>> > > +/* { dg-options "-O2" } */
>> > > +
>> > > +volatile int gi;
>> > > +
>> > > +static const int values[3] = {5, 7, 11};
>> > > +
>> > > +void link_error (void);
>> > > +
>> > > +[[gnu::noinline]] void foo (int index)
>> > > +{
>> > > +  const int v = values[index];
>> > > +  if (v <= 2
>> > > +      || v > 666)
>> > 
>> > Possibly a silly question, but why "666" here?
>> 
>> I happened to be listening to Iron Maiden quite a lot when writing
>> the
>> patch.
>
>> 
>> > Isn't 11 a tighter
>> > bound, based on the values above? (and thus a stronger test case)
>> 
>> So I actually wanted to select a bound that would not be the
>> tightest,
>> that looked like a more "arbitrary" and thus "stronger" test case to
>> me.
>> But in reality I cannot see how it could really matter one way or
>> another.
>> 
>> In any event, I can change it to - I don't know - 17 if you or anyone
>> thinks such cultural references are unwanted.
>> 
>> Martin
>> 
> "Bounds of the Beast"
>
> In the dark of the code, where logic hides,
> Lurks a test case with fire in its eyes.
> It hunts for the edges, the limits so tight,
> To challenge the range with its unyielding might.
>
> The program may waver, it may slip and sway,
> But the bounds are the keepers that must not decay.
> The tightest of thresholds, the razor-sharp line,
> Are the ones that will break, or the ones that will shine!
>
> So verify each boundary, test every frame,
> Ensure no invalids dare stake their claim.
> For the tightest of ranges reveal what's pure,
> A world of precision, where errors can't endure!
>
> Chorus:
> Oh, the bounds! Test the bounds!
> On the edge of the code where no flaw is found!
> Only the tightest will show us the way,
> To victory in logic, and clarity's day!
>
> In the heart of the test, where the truth lies untold,
> You must seek the extremes—the narrow, the bold.
> For only the sharpest, the narrowest might,
> Will defend the program through day and through night.
>
> Why the tightest bounds?
> It's the key, it's the sound!
> Of breaking the edge, of breaking the ground.
> With the widest open range, you risk endless strife,
> So test for the tight, or face endless strife!
>
> (End riff)
>
> [generated by ChatGPT, with prompt "Write an explanation of why a test
> case for a program that calculates ranges of valid values ought to
> verify the tightest possible bounds, in the style of early Iron Maiden
> lyrics."]

OK, I'll change the tests :-)

But it's difficult not to put this to the testcase as a comment now ;-)

Martin

Reply via email to