https://gcc.gnu.org/g:9c926d8b83a8229e0b4335cc78b2bee1b85b58af

commit r14-11017-g9c926d8b83a8229e0b4335cc78b2bee1b85b58af
Author: Gaius Mulley <gaiusm...@gmail.com>
Date:   Mon Dec 2 13:25:14 2024 +0000

    [PATCH] PR modula2/117555: libgm2 build failure after 
r15-5081-g95960cd473297c
    
    This patch adds missing return statements to library procedure
    functions.  These missing statements occur after a call to RAISE.
    
    gcc/m2/ChangeLog:
    
            PR modula2/117555
            * gm2-libs-iso/M2EXCEPTION.mod (M2Exception): Add missing
            return statement.
            * gm2-libs-iso/RealConv.mod (ValueReal): Ditto.
            * gm2-libs-iso/RndFile.mod (StartPos): Ditto.
            (EndPos): Ditto.
            (NewPos): Ditto.
            * gm2-libs-iso/ShortConv.mod (ValueReal): Ditto.
            * gm2-libs-iso/WholeConv.mod (ValueInt): Ditto.
            (ValueCard): Ditto.
    
    (cherry picked from commit 6d90f5d0ae928320e6e4ce9fce8e658404d8cb72)
    
    Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>

Diff:
---
 gcc/m2/gm2-libs-iso/M2EXCEPTION.mod |  3 ++-
 gcc/m2/gm2-libs-iso/RealConv.mod    |  3 ++-
 gcc/m2/gm2-libs-iso/RndFile.mod     | 15 +++++++++------
 gcc/m2/gm2-libs-iso/ShortConv.mod   |  3 ++-
 gcc/m2/gm2-libs-iso/WholeConv.mod   |  6 ++++--
 5 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/gcc/m2/gm2-libs-iso/M2EXCEPTION.mod 
b/gcc/m2/gm2-libs-iso/M2EXCEPTION.mod
index 637e086c2998..2ff7c7296647 100644
--- a/gcc/m2/gm2-libs-iso/M2EXCEPTION.mod
+++ b/gcc/m2/gm2-libs-iso/M2EXCEPTION.mod
@@ -42,7 +42,8 @@ BEGIN
    ELSE
       RTExceptions.Raise(ORD(exException),
                          ADR(__FILE__), __LINE__, __COLUMN__, 
ADR(__FUNCTION__),
-                         ADR('current coroutine is not in the exceptional 
execution state'))
+                         ADR('current coroutine is not in the exceptional 
execution state')) ;
+      RETURN exException
    END
 END M2Exception ;
 
diff --git a/gcc/m2/gm2-libs-iso/RealConv.mod b/gcc/m2/gm2-libs-iso/RealConv.mod
index 4223f3029ae8..6f9fe6fcc7b2 100644
--- a/gcc/m2/gm2-libs-iso/RealConv.mod
+++ b/gcc/m2/gm2-libs-iso/RealConv.mod
@@ -256,7 +256,8 @@ BEGIN
       RETURN( doValueReal(str) )
    ELSE
       EXCEPTIONS.RAISE(realConv, ORD(invalid),
-                       'RealConv.' + __FUNCTION__ + ': real number is invalid')
+                       'RealConv.' + __FUNCTION__ + ': real number is 
invalid') ;
+      RETURN 0.0
    END
 END ValueReal ;
 
diff --git a/gcc/m2/gm2-libs-iso/RndFile.mod b/gcc/m2/gm2-libs-iso/RndFile.mod
index 46a2efdaac4a..42451888bafe 100644
--- a/gcc/m2/gm2-libs-iso/RndFile.mod
+++ b/gcc/m2/gm2-libs-iso/RndFile.mod
@@ -359,13 +359,13 @@ VAR
 BEGIN
    IF IsRndFile(cid)
    THEN
-      d := DeviceTablePtrValue(cid, did) ;
-      RETURN( 0 )
+      d := DeviceTablePtrValue(cid, did)
    ELSE
       RAISEdevException(cid, did, IOChan.wrongDevice,
                         'RndFile.' + __FUNCTION__ +
                         ': channel is not a random file')
-   END
+   END ;
+   RETURN( 0 )
 END StartPos ;
 
 
@@ -386,7 +386,8 @@ BEGIN
    ELSE
       RAISEdevException(cid, did, IOChan.wrongDevice,
                         'RndFile.' + __FUNCTION__ +
-                        ': channel is not a random file')
+                        ': channel is not a random file') ;
+      RETURN 0
    END
 END CurrentPos ;
 
@@ -416,7 +417,8 @@ BEGIN
    ELSE
       RAISEdevException(cid, did, IOChan.wrongDevice,
                         'RndFile.' + __FUNCTION__ +
-                        ': channel is not a random file')
+                        ': channel is not a random file') ;
+      RETURN 0
    END
 END EndPos ;
 
@@ -442,7 +444,8 @@ BEGIN
    ELSE
       RAISEdevException(cid, did, IOChan.wrongDevice,
                         'RndFile.' + __FUNCTION__ +
-                        ': channel is not a random file')
+                        ': channel is not a random file') ;
+      RETURN 0
    END
 END NewPos ;
 
diff --git a/gcc/m2/gm2-libs-iso/ShortConv.mod 
b/gcc/m2/gm2-libs-iso/ShortConv.mod
index cfceb25c8f4c..bb835c6102ec 100644
--- a/gcc/m2/gm2-libs-iso/ShortConv.mod
+++ b/gcc/m2/gm2-libs-iso/ShortConv.mod
@@ -257,7 +257,8 @@ BEGIN
       RETURN( doValueReal(str) )
    ELSE
       EXCEPTIONS.RAISE(realConv, ORD(invalid),
-                       'ShortConv.' + __FUNCTION__ + ': real number is 
invalid')
+                       'ShortConv.' + __FUNCTION__ + ': real number is 
invalid') ;
+      RETURN 0.0
    END
 END ValueReal ;
 
diff --git a/gcc/m2/gm2-libs-iso/WholeConv.mod 
b/gcc/m2/gm2-libs-iso/WholeConv.mod
index 34ca7aca1a11..769a568fe32f 100644
--- a/gcc/m2/gm2-libs-iso/WholeConv.mod
+++ b/gcc/m2/gm2-libs-iso/WholeConv.mod
@@ -196,7 +196,8 @@ BEGIN
       RETURN( v )
    ELSE
       EXCEPTIONS.RAISE(wholeConv, ORD(invalidSigned),
-                       'WholeConv.' + __FUNCTION__ + ': signed number is 
invalid')
+                       'WholeConv.' + __FUNCTION__ + ': signed number is 
invalid') ;
+      RETURN 0
    END
 END ValueInt ;
 
@@ -333,7 +334,8 @@ BEGIN
       RETURN( value )
    ELSE
       EXCEPTIONS.RAISE(wholeConv, ORD(invalidUnsigned),
-                       'WholeConv:' + __FUNCTION__ + ': unsigned number is 
invalid')
+                       'WholeConv:' + __FUNCTION__ + ': unsigned number is 
invalid') ;
+      RETURN 0
    END
 END ValueCard ;

Reply via email to