This fixes a problem that occurs when compiled by gcc-10, as the code
is relying on undefined overflow behavior.  This is fixed by replacing
compares between 32-bit and 64-bit results with compares that just use
the 64-bit results with a cast.
	PR sim/27483
	* simulator.c (set_flags_for_add32): Compare uresult against
	itself.  Compare sresult against itself.
+2021-04-07  Jim Wilson  <jimw@sifive.com>
+
+       PR sim/27483
+       * simulator.c (set_flags_for_add32): Compare uresult against
+       itself.  Compare sresult against itself.
+
 2021-04-02  Mike Frysinger  <vapier@gentoo.org>
 
        * aclocal.m4, configure: Regenerate.
 
   if (result & (1 << 31))
     flags |= N;
 
-  if (uresult != (uint32_t)result)
+  if (uresult != (uint32_t)uresult)
     flags |= C;
 
-  if (sresult != result)
+  if (sresult != (int32_t)sresult)
     flags |= V;
 
   aarch64_set_CPSR (cpu, flags);