public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add missing return in gori_compute::logical_combine
@ 2023-09-25 15:51 Eric Botcazou
  2023-09-25 17:09 ` Andrew MacLeod
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2023-09-25 15:51 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

Hi,

the varying case currently falls through to the 1/true case.

Tested on x86_64-suse-linux, OK for mainline, 13 and 12 branches?


2023-09-25  Eric Botcazou  <ebotcazou@adacore.com>

	* gimple-range-gori.cc (gori_compute::logical_combine): Add missing
	return statement in the varying case.


2023-09-25  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/opt102.adb:New test.
	* gnat.dg/opt102_pkg.adb, gnat.dg/opt102_pkg.ads: New helper.

-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 350 bytes --]

diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 51fb542a19c..2694e551d73 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -876,6 +876,7 @@ gori_compute::logical_combine (vrange &r, enum tree_code code,
 	  r.dump (dump_file);
 	  fputc ('\n', dump_file);
 	}
+      return res;
     }
 
   switch (code)

[-- Attachment #3: opt102_pkg.adb --]
[-- Type: text/x-adasrc, Size: 253 bytes --]

package body Opt102_Pkg is

  function Get (E : Enum; F, M : access Integer) return Integer is
  begin
    case E is
      when One   => return 0;
      when Two   => return F.all;
      when Three => return M.all;
    end case;
  end;

end Opt102_Pkg;

[-- Attachment #4: opt102.adb --]
[-- Type: text/x-adasrc, Size: 174 bytes --]

-- { dg-do run }
-- { dg-options "-O2 -gnata" }

with Opt102_Pkg; use Opt102_Pkg;

procedure Opt102 is
  I, F : aliased Integer;
begin
  I := Get (Two, F'Access, null);
end;

[-- Attachment #5: opt102_pkg.ads --]
[-- Type: text/x-adasrc, Size: 282 bytes --]

package Opt102_Pkg is

  type Enum is (One, Two, Three);

  function Get (E : Enum; F, M : access Integer) return Integer
    with Pre => (E = One) = (F = null and M = null) and
                (E = Two) = (F /= null) and
                (E = Three) = (M /= null);

end Opt102_Pkg;

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

* Re: [PATCH] Add missing return in gori_compute::logical_combine
  2023-09-25 15:51 [PATCH] Add missing return in gori_compute::logical_combine Eric Botcazou
@ 2023-09-25 17:09 ` Andrew MacLeod
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew MacLeod @ 2023-09-25 17:09 UTC (permalink / raw)
  To: Eric Botcazou, gcc-patches

OK for trunk at least.   Thanks.  I presume it'll be fine for the other 
releases.

Andrew

On 9/25/23 11:51, Eric Botcazou wrote:
> Hi,
>
> the varying case currently falls through to the 1/true case.
>
> Tested on x86_64-suse-linux, OK for mainline, 13 and 12 branches?
>
>
> 2023-09-25  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* gimple-range-gori.cc (gori_compute::logical_combine): Add missing
> 	return statement in the varying case.
>
>
> 2023-09-25  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* gnat.dg/opt102.adb:New test.
> 	* gnat.dg/opt102_pkg.adb, gnat.dg/opt102_pkg.ads: New helper.
>


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25 15:51 [PATCH] Add missing return in gori_compute::logical_combine Eric Botcazou
2023-09-25 17:09 ` Andrew MacLeod

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