Skip to contentSkip to conversation

subprojects/berkeley-testfloat-3: Update to fix a problem with compiler warnings

PATCH In review Thomas Huth 5 participants 6 messages Aug 16, 2023 – Aug 17, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 subprojects/berkeley-testfloat-3: Update to fix a problem with compiler warnings

Update the berkeley-testfloat-3 wrap to include a patch provided by Olaf Hering. This fixes a problem with "control reaches end of non-void function [-Werror=return-type]" compiler warning/errors that are now enabled by default in certain versions of GCC.

---
 subprojects/berkeley-testfloat-3.wrap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
subprojects/berkeley-testfloat-3.wrap +1 -1
index 6ad80a37b2..c86dc078a8 100644
@@ -1,5 +1,5 @@
 [wrap-git]
 url = https://gitlab.com/qemu-project/berkeley-testfloat-3
-revision = 40619cbb3bf32872df8c53cc457039229428a263
+revision = e7af9751d9f9fd3b47911f51a5cfd08af256a9ab
 patch_directory = berkeley-testfloat-3
 depth = 1
Signature · 1 line
2.39.3
#1 lore raw
Quoted 4 lines · Thomas Huth

Update the berkeley-testfloat-3 wrap to include a patch provided by Olaf Hering. This fixes a problem with "control reaches end of non-void function [-Werror=return-type]" compiler warning/errors that are now enabled by default in certain versions of GCC.

e7af9751d9 has:

source/genCases_f32.c +1 -0
@@ -411,6 +411,7 @@ static float32_t f32Random( void )
      case 6:
         return f32RandomQInfP3();
      case 7:
+     default:
         return f32RandomQInfPInf();
     }
 

Why the default is with 7 and not 3 or 5? Shouldn't we abort() or mark with __builtin_unreachable()?

Quoted 6 lines
---
  subprojects/berkeley-testfloat-3.wrap | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw

Wed, 16 Aug 2023 14:49:07 +0200 Philippe Mathieu-Daudé <[email protected]>:

Quoted 2 lines

Why the default is with 7 and not 3 or 5? Shouldn't we abort() or mark with __builtin_unreachable()?

In the referenced bug it was suggested to add a trailing "unreachable". But suggestion arrived after my MR, and I'm also not sure if there is a way to implement it for all supported compilers.

Olaf

#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Thomas Huth

Update the berkeley-testfloat-3 wrap to include a patch provided by Olaf Hering. This fixes a problem with "control reaches end of non-void function [-Werror=return-type]" compiler warning/errors that are now enabled by default in certain versions of GCC.

e7af9751d9 has:

source/genCases_f32.c +1 -0
@@ -411,6 +411,7 @@ static float32_t f32Random( void )
       case 6:
          return f32RandomQInfP3();
       case 7:
+     default:
          return f32RandomQInfPInf();
      }
 
Quoted 2 lines

Why the default is with 7 and not 3 or 5? Shouldn't we abort() or mark with __builtin_unreachable()?

If you look at the code, it's really impossible to get any other values here, so an abort() or something similar would not really help to discover additional bugs (except buggy compilers maybe). So I personally don't care too much, but if it bugs you, feel free to send another patch on top of it.

Thomas

#4 lore raw
In reply to Thomas Huth
Quoted 11 lines · Thomas Huth

Update the berkeley-testfloat-3 wrap to include a patch provided by Olaf Hering. This fixes a problem with "control reaches end of non-void function [-Werror=return-type]" compiler warning/errors that are now enabled by default in certain versions of GCC.

---
 subprojects/berkeley-testfloat-3.wrap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

This seems like a reasonable place to ask: should we just pull in the testfloat and softfloat repos to be part of the main qemu repo? AIUI we've definitively forked both of these, so we don't care about trying to make it easy to resync with upstream. Having them in separate git repos seems to have some clear disadvantages:
* it's harder to update them
* changes to them can end up skipping the usual code review process, because it's a different patch flow to the normal one
* we get extra meson subproject infrastructure to deal with

Are there any reasons to keep them separate ?

thanks
-- PMM

#5 lore raw
Quoted 13 lines · Peter Maydell
Quoted 11 lines · Thomas Huth

Update the berkeley-testfloat-3 wrap to include a patch provided by Olaf Hering. This fixes a problem with "control reaches end of non-void function [-Werror=return-type]" compiler warning/errors that are now enabled by default in certain versions of GCC.

---
 subprojects/berkeley-testfloat-3.wrap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 3 lines

This seems like a reasonable place to ask: should we just pull in the testfloat and softfloat repos to be part of the main qemu repo?

We've definitely forked the softfloat inside QEMU with the refactor some time ago. For the testing repos we have lightly modified them to build the test code but only by a few patches. We might want to keep the ability to re-base on a new release if say test float gains fp16 or bfloat16 support.

Quoted 14 lines

AIUI we've definitively forked both of these, so
we don't care about trying to make it easy to resync with upstream. Having them in separate git repos seems to have some clear disadvantages:
* it's harder to update them
* changes to them can end up skipping the usual code review process, because it's a different patch flow to the normal one
* we get extra meson subproject infrastructure to deal with

Are there any reasons to keep them separate ?

thanks
-- PMM

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro