[gcc r14-8025] gccrs: Fix ICE when emitting an error during cfg strip

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 18:14:32 GMT 2024


https://gcc.gnu.org/g:5757c304b539dc30c5cacf278bb026738288854a

commit r14-8025-g5757c304b539dc30c5cacf278bb026738288854a
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Tue Sep 26 14:49:10 2023 +0200

    gccrs: Fix ICE when emitting an error during cfg strip
    
    When an error was emitted during the cfg strip pass by the crate loader,
    it was ignored and the error state propagated until another pass
    (name resolver).
    
    gcc/rust/ChangeLog:
    
            * rust-session-manager.cc (Session::expansion): Add early break on
            error.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/rust-session-manager.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 1273b53496c..3edd1ecb4eb 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -877,6 +877,9 @@ Session::expansion (AST::Crate &crate)
   while (!fixed_point_reached && iterations < cfg.recursion_limit)
     {
       CfgStrip ().go (crate);
+      // Errors might happen during cfg strip pass
+      if (saw_errors ())
+	break;
 
       auto ctx = Resolver2_0::NameResolutionContext ();


More information about the Gcc-cvs mailing list