diff --git a/gcc/ada/libgnat/a-cfdlli.adb b/gcc/ada/libgnat/a-cfdlli.adb
index 383d031d71548216a828ec3e7d009f74bafde2c3..7b23ad79232e901b0224afed524983f606ced1cd 100644
--- a/gcc/ada/libgnat/a-cfdlli.adb
+++ b/gcc/ada/libgnat/a-cfdlli.adb
@@ -68,9 +68,9 @@ is
       end if;
 
       LI := Left.First;
-      RI := Left.First;
+      RI := Right.First;
       while LI /= 0 loop
-         if Left.Nodes (LI).Element /= Right.Nodes (LI).Element then
+         if Left.Nodes (LI).Element /= Right.Nodes (RI).Element then
             return False;
          end if;