linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Raise the minimum required gcc version to 4.6
@ 2018-08-20 20:15 Joe Perches
  2018-08-20 20:25 ` Nick Desaulniers
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Joe Perches @ 2018-08-20 20:15 UTC (permalink / raw)
  To: Linus Torvalds, linux-kernel
  Cc: Andrew Morton, Dave Hansen, Mike Galbraith, Guenter Roeck,
	Rik van Riel, Kees Cook, Nick Desaulniers, Jonathan Corbet,
	linux-doc

Various architectures fail to build properly with older versions
of the gcc compiler.

An example from Guenter Roeck via this thread:
https://lore.kernel.org/lkml/20180814170904.GA12768@roeck-us.net/

----------------------
In file included from ./include/linux/mm.h:17:0,
                 from ./include/linux/pid_namespace.h:7,
                 from ./include/linux/ptrace.h:10,
                 from arch/openrisc/kernel/asm-offsets.c:32:
./include/linux/mm_types.h:497:16: error: flexible array member in otherwise empty struct

This is just an example with gcc 4.5.1 for or32. I have seen the problem
with gcc 4.4 (for unicore32) as well.
----------------------

So update the minimum required version of gcc to 4.6.

Miscellanea:

o Update Documentation/process/changes.rst
o Remove and consolidate version test blocks in compiler-gcc.h
  for versions lower than 4.6

Signed-off-by: Joe Perches <joe@perches.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
---
 Documentation/process/changes.rst |  2 +-
 include/linux/compiler-gcc.h      | 86 ++++++++-------------------------------
 2 files changed, 19 insertions(+), 69 deletions(-)

diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst
index 7a92a06f90de..61f918b10a0c 100644
--- a/Documentation/process/changes.rst
+++ b/Documentation/process/changes.rst
@@ -29,7 +29,7 @@ you probably needn't concern yourself with isdn4k-utils.
 ====================== ===============  ========================================
         Program        Minimal version       Command to check the version
 ====================== ===============  ========================================
-GNU C                  3.2              gcc --version
+GNU C                  4.6              gcc --version
 GNU make               3.81             make --version
 binutils               2.20             ld -v
 flex                   2.5.35           flex --version
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 3e70b7d4e9ed..250b9b7cfd60 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -10,6 +10,10 @@
 		     + __GNUC_MINOR__ * 100	\
 		     + __GNUC_PATCHLEVEL__)
 
+#if GCC_VERSION < 40600
+# error Sorry, your compiler is too old - please upgrade it.
+#endif
+
 /* Optimization barrier */
 
 /* The "volatile" is due to gcc bugs */
@@ -58,6 +62,12 @@
 #define OPTIMIZER_HIDE_VAR(var)						\
 	__asm__ ("" : "=r" (var) : "0" (var))
 
+/*
+ * A trick to suppress uninitialized variable warning without generating any
+ * code
+ */
+#define uninitialized_var(x) x = x
+
 #ifdef __CHECKER__
 #define __must_be_array(a)	0
 #else
@@ -91,7 +101,7 @@
  * A lot of inline functions can cause havoc with function tracing.
  */
 #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) ||		\
-    !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
+    !defined(CONFIG_OPTIMIZE_INLINING)
 #define inline \
 	inline __attribute__((always_inline, unused)) notrace __gnu_inline
 #else
@@ -147,47 +157,13 @@
 #define __always_unused		__attribute__((unused))
 #define __mode(x)               __attribute__((mode(x)))
 
-/* gcc version specific checks */
-
-#if GCC_VERSION < 30200
-# error Sorry, your compiler is too old - please upgrade it.
-#endif
-
-#if GCC_VERSION < 30300
-# define __used			__attribute__((__unused__))
-#else
-# define __used			__attribute__((__used__))
-#endif
-
-#ifdef CONFIG_GCOV_KERNEL
-# if GCC_VERSION < 30400
-#   error "GCOV profiling support for gcc versions below 3.4 not included"
-# endif /* __GNUC_MINOR__ */
-#endif /* CONFIG_GCOV_KERNEL */
-
-#if GCC_VERSION >= 30400
 #define __must_check		__attribute__((warn_unused_result))
 #define __malloc		__attribute__((__malloc__))
-#endif
-
-#if GCC_VERSION >= 40000
-
-/* GCC 4.1.[01] miscompiles __weak */
-#ifdef __KERNEL__
-# if GCC_VERSION >= 40100 &&  GCC_VERSION <= 40101
-#  error Your version of gcc miscompiles the __weak directive
-# endif
-#endif
 
 #define __used			__attribute__((__used__))
 #define __compiler_offsetof(a, b)					\
 	__builtin_offsetof(a, b)
 
-#if GCC_VERSION >= 40100
-# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
-#endif
-
-#if GCC_VERSION >= 40300
 /* Mark functions as cold. gcc will assume any path leading to a call
  * to them will be unlikely.  This means a lot of manual unlikely()s
  * are unnecessary now for any paths leading to the usual suspects
@@ -206,24 +182,19 @@
 
 #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
 
-#ifndef __CHECKER__
-# define __compiletime_warning(message) __attribute__((warning(message)))
-# define __compiletime_error(message) __attribute__((error(message)))
-#endif /* __CHECKER__ */
-#endif /* GCC_VERSION >= 40300 */
-
-#if GCC_VERSION >= 40400
 #define __optimize(level)	__attribute__((__optimize__(level)))
 #define __nostackprotector	__optimize("no-stack-protector")
-#endif /* GCC_VERSION >= 40400 */
 
-#if GCC_VERSION >= 40500
+#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
 
 #ifndef __CHECKER__
+#define __compiletime_warning(message) __attribute__((warning(message)))
+#define __compiletime_error(message) __attribute__((error(message)))
+
 #ifdef LATENT_ENTROPY_PLUGIN
 #define __latent_entropy __attribute__((latent_entropy))
 #endif
-#endif
+#endif /* __CHECKER__ */
 
 /*
  * calling noreturn functions, __builtin_unreachable() and __builtin_trap()
@@ -261,10 +232,6 @@
 #define randomized_struct_fields_end	} __randomize_layout;
 #endif
 
-#endif /* GCC_VERSION >= 40500 */
-
-#if GCC_VERSION >= 40600
-
 /*
  * When used with Link Time Optimization, gcc can optimize away C functions or
  * variables which are referenced only from assembly code.  __visible tells the
@@ -273,8 +240,7 @@
  */
 #define __visible	__attribute__((externally_visible))
 
-#endif /* GCC_VERSION >= 40600 */
-
+/* gcc version specific checks */
 
 #if GCC_VERSION >= 40900 && !defined(__CHECKER__)
 /*
@@ -308,10 +274,8 @@
  * folding in __builtin_bswap*() (yet), so don't set these for it.
  */
 #if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP) && !defined(__CHECKER__)
-#if GCC_VERSION >= 40400
 #define __HAVE_BUILTIN_BSWAP32__
 #define __HAVE_BUILTIN_BSWAP64__
-#endif
 #if GCC_VERSION >= 40800
 #define __HAVE_BUILTIN_BSWAP16__
 #endif
@@ -340,10 +304,9 @@
  * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
  */
 #define __designated_init __attribute__((designated_init))
+#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
 #endif
 
-#endif	/* gcc version >= 40000 specific checks */
-
 #if !defined(__noclone)
 #define __noclone	/* not needed */
 #endif
@@ -352,16 +315,6 @@
 #define __no_sanitize_address
 #endif
 
-/*
- * A trick to suppress uninitialized variable warning without generating any
- * code
- */
-#define uninitialized_var(x) x = x
-
-#if GCC_VERSION >= 50100
-#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
-#endif
-
 /*
  * Turn individual warnings and errors on and off locally, depending
  * on version.
@@ -374,12 +327,9 @@
 #define __diag_GCC_warn		warning
 #define __diag_GCC_error	error
 
-/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */
-#if GCC_VERSION >= 40600
 #define __diag_str1(s)		#s
 #define __diag_str(s)		__diag_str1(s)
 #define __diag(s)		_Pragma(__diag_str(GCC diagnostic s))
-#endif
 
 #if GCC_VERSION >= 80000
 #define __diag_GCC_8(s)		__diag(s)
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-20 20:15 [PATCH] Raise the minimum required gcc version to 4.6 Joe Perches
@ 2018-08-20 20:25 ` Nick Desaulniers
  2018-08-20 20:42 ` Jonathan Corbet
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Nick Desaulniers @ 2018-08-20 20:25 UTC (permalink / raw)
  To: joe
  Cc: Linus Torvalds, LKML, Andrew Morton, dave.hansen, efault,
	Guenter Roeck, riel, Kees Cook, corbet, linux-doc

On Mon, Aug 20, 2018 at 1:15 PM Joe Perches <joe@perches.com> wrote:
>
> Various architectures fail to build properly with older versions
> of the gcc compiler.

Just curious if certain arch's require older versions of gcc?  Surely
that's not the case, but hopefully this patch wont surprise anyone.

It might be worthwhile to see where else in the kernel has
/gcc\s+[0-9]/g as I'm sure there's other old-gcc workarounds that can
go too (in follow up patches).

Thanks for sending.  This helps us ship newer compiler features for
which older compiler support is difficult/impossible.
-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-20 20:15 [PATCH] Raise the minimum required gcc version to 4.6 Joe Perches
  2018-08-20 20:25 ` Nick Desaulniers
@ 2018-08-20 20:42 ` Jonathan Corbet
  2018-08-20 20:48   ` Joe Perches
  2018-08-21  6:55 ` Masahiro Yamada
  2018-08-23 21:52 ` Geert Uytterhoeven
  3 siblings, 1 reply; 13+ messages in thread
From: Jonathan Corbet @ 2018-08-20 20:42 UTC (permalink / raw)
  To: Joe Perches
  Cc: Linus Torvalds, linux-kernel, Andrew Morton, Dave Hansen,
	Mike Galbraith, Guenter Roeck, Rik van Riel, Kees Cook,
	Nick Desaulniers, linux-doc

On Mon, 20 Aug 2018 13:15:26 -0700
Joe Perches <joe@perches.com> wrote:

> +#if GCC_VERSION < 40600
> +# error Sorry, your compiler is too old - please upgrade it.
> +#endif

It seems we could be a little friendlier here?  "Kernel compilation
requires GCC >= v4.6, please upgrade" ?

jon

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-20 20:42 ` Jonathan Corbet
@ 2018-08-20 20:48   ` Joe Perches
  0 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2018-08-20 20:48 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Linus Torvalds, linux-kernel, Andrew Morton, Dave Hansen,
	Mike Galbraith, Guenter Roeck, Rik van Riel, Kees Cook,
	Nick Desaulniers, linux-doc

On Mon, 2018-08-20 at 14:42 -0600, Jonathan Corbet wrote:
> On Mon, 20 Aug 2018 13:15:26 -0700
> Joe Perches <joe@perches.com> wrote:
> 
> > +#if GCC_VERSION < 40600
> > +# error Sorry, your compiler is too old - please upgrade it.
> > +#endif
> 
> It seems we could be a little friendlier here?  "Kernel compilation
> requires GCC >= v4.6, please upgrade" ?

This is unchanged text, it's just moved around, but sure, trivial...

Wordsmithing should likely be a separate patch though.
---
 include/linux/compiler-gcc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 250b9b7cfd60..5d95cabd13b3 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -11,7 +11,7 @@
 		     + __GNUC_PATCHLEVEL__)
 
 #if GCC_VERSION < 40600
-# error Sorry, your compiler is too old - please upgrade it.
+# error Kernel compilation requires GCC >= v4.6, please upgrade your compiler
 #endif
 
 /* Optimization barrier */



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-20 20:15 [PATCH] Raise the minimum required gcc version to 4.6 Joe Perches
  2018-08-20 20:25 ` Nick Desaulniers
  2018-08-20 20:42 ` Jonathan Corbet
@ 2018-08-21  6:55 ` Masahiro Yamada
  2018-08-21 19:40   ` Linus Torvalds
  2018-08-23 21:52 ` Geert Uytterhoeven
  3 siblings, 1 reply; 13+ messages in thread
From: Masahiro Yamada @ 2018-08-21  6:55 UTC (permalink / raw)
  To: Joe Perches
  Cc: Linus Torvalds, Linux Kernel Mailing List, Andrew Morton,
	Dave Hansen, Mike Galbraith, Guenter Roeck, Rik van Riel,
	Kees Cook, Nick Desaulniers, Jonathan Corbet,
	open list:DOCUMENTATION

Hi.



2018-08-21 5:15 GMT+09:00 Joe Perches <joe@perches.com>:
> Various architectures fail to build properly with older versions
> of the gcc compiler.
>
> An example from Guenter Roeck via this thread:
> https://lore.kernel.org/lkml/20180814170904.GA12768@roeck-us.net/
>
> ----------------------
> In file included from ./include/linux/mm.h:17:0,
>                  from ./include/linux/pid_namespace.h:7,
>                  from ./include/linux/ptrace.h:10,
>                  from arch/openrisc/kernel/asm-offsets.c:32:
> ./include/linux/mm_types.h:497:16: error: flexible array member in otherwise empty struct
>
> This is just an example with gcc 4.5.1 for or32. I have seen the problem
> with gcc 4.4 (for unicore32) as well.
> ----------------------
>
> So update the minimum required version of gcc to 4.6.
>
> Miscellanea:
>
> o Update Documentation/process/changes.rst
> o Remove and consolidate version test blocks in compiler-gcc.h
>   for versions lower than 4.6
>
> Signed-off-by: Joe Perches <joe@perches.com>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---


This broke Clang build.
I sent a patch.

https://lore.kernel.org/patchwork/patch/976025/

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-21  6:55 ` Masahiro Yamada
@ 2018-08-21 19:40   ` Linus Torvalds
  2018-08-21 23:41     ` Nick Desaulniers
  0 siblings, 1 reply; 13+ messages in thread
From: Linus Torvalds @ 2018-08-21 19:40 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Joe Perches, Linux Kernel Mailing List, Andrew Morton,
	Dave Hansen, Mike Galbraith, Guenter Roeck, Rik van Riel,
	Kees Cook, Nick Desaulniers, Jonathan Corbet,
	open list:DOCUMENTATION

On Mon, Aug 20, 2018 at 11:56 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> This broke Clang build.

As mentioned elsewhere, I think the clang build was broken before anyway?

> I sent a patch.
>
> https://lore.kernel.org/patchwork/patch/976025/

Yeah, I'd rather just have the clang case have its own file, instead
of be back in the situation where clang depends on gcc and then has a
different versioning model so we need to have insane clang version
tests in the gcc file.

                Linus

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-21 19:40   ` Linus Torvalds
@ 2018-08-21 23:41     ` Nick Desaulniers
  0 siblings, 0 replies; 13+ messages in thread
From: Nick Desaulniers @ 2018-08-21 23:41 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Masahiro Yamada, joe, LKML, Andrew Morton, dave.hansen, efault,
	Guenter Roeck, Rik van Riel, Kees Cook, Jonathan Corbet,
	linux-doc

On Tue, Aug 21, 2018 at 12:40 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Mon, Aug 20, 2018 at 11:56 PM Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> >
> > This broke Clang build.
>
> As mentioned elsewhere, I think the clang build was broken before anyway?
>
> > I sent a patch.
> >
> > https://lore.kernel.org/patchwork/patch/976025/
>
> Yeah, I'd rather just have the clang case have its own file, instead
> of be back in the situation where clang depends on gcc and then has a
> different versioning model so we need to have insane clang version
> tests in the gcc file.
>
>                 Linus

WIP patch at: https://github.com/ClangBuiltLinux/linux/commit/1f89ae7622c26b8131f42f3a362d6ef41b88a595
Would be happy to get early feedback.  Does anyone know who I should
talk to about testing w/ ICC?

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-20 20:15 [PATCH] Raise the minimum required gcc version to 4.6 Joe Perches
                   ` (2 preceding siblings ...)
  2018-08-21  6:55 ` Masahiro Yamada
@ 2018-08-23 21:52 ` Geert Uytterhoeven
  2018-08-23 22:00   ` Nick Desaulniers
  2018-08-23 22:00   ` Joe Perches
  3 siblings, 2 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2018-08-23 21:52 UTC (permalink / raw)
  To: Joe Perches
  Cc: torvalds, Linux Kernel Mailing List, Andrew Morton, Dave Hansen,
	Mike Galbraith, Guenter Roeck, riel, Kees Cook, Nick Desaulniers,
	Jonathan Corbet, open list:DOCUMENTATION, Arnd Bergmann

Hi Joe,

On Mon, Aug 20, 2018 at 10:15 PM Joe Perches <joe@perches.com> wrote:
> Various architectures fail to build properly with older versions
> of the gcc compiler.
>
> An example from Guenter Roeck via this thread:
> https://lore.kernel.org/lkml/20180814170904.GA12768@roeck-us.net/
>
> ----------------------
> In file included from ./include/linux/mm.h:17:0,
>                  from ./include/linux/pid_namespace.h:7,
>                  from ./include/linux/ptrace.h:10,
>                  from arch/openrisc/kernel/asm-offsets.c:32:
> ./include/linux/mm_types.h:497:16: error: flexible array member in otherwise empty struct
>
> This is just an example with gcc 4.5.1 for or32. I have seen the problem
> with gcc 4.4 (for unicore32) as well.
> ----------------------
>
> So update the minimum required version of gcc to 4.6.
>
> Miscellanea:
>
> o Update Documentation/process/changes.rst
> o Remove and consolidate version test blocks in compiler-gcc.h
>   for versions lower than 4.6
>
> Signed-off-by: Joe Perches <joe@perches.com>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Thanks for your patch!

I'm willing to upgrade. But there's one thing that's holding me back.

Does gcc 8.x gives again the same warnings as my venerable old gcc 4.1.2,
that no one else seems to see? Or will the real bugs I detect this way stay
unfixed? Polyculture is a good thing, also in compilers.

Reverted locally (incl. the follow-up), applied Andrew's fix, detected new
warnings in v4.18+, and sent patches where it makes sense...

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-23 21:52 ` Geert Uytterhoeven
@ 2018-08-23 22:00   ` Nick Desaulniers
  2018-08-23 22:00   ` Joe Perches
  1 sibling, 0 replies; 13+ messages in thread
From: Nick Desaulniers @ 2018-08-23 22:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: joe, Linus Torvalds, LKML, Andrew Morton, dave.hansen, efault,
	Guenter Roeck, Rik van Riel, Kees Cook, Jonathan Corbet,
	linux-doc, Arnd Bergmann

On Thu, Aug 23, 2018 at 2:52 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Thanks for your patch!
>
> I'm willing to upgrade. But there's one thing that's holding me back.
>
> Does gcc 8.x gives again the same warnings as my venerable old gcc 4.1.2,
> that no one else seems to see? Or will the real bugs I detect this way stay
> unfixed? Polyculture is a good thing, also in compilers.

Hi Geert,
Just for folks who may be missing context on this thread, like myself,
can you provide links to more information?  If I understand your
question correctly, it seems that warnings were removed from gcc since
4.1.2?  And that bugs have been caught by testing with gcc 4.1.2 (can
you provide commit sha's)?  I assume you've already discussed such an
issue with the gcc maintainers (can you provide links to those
discussions)?  Sorry, if this has already been discussed already on
LKML, but even a post that had all this information would be immensely
helpful in understanding your plight.

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-23 21:52 ` Geert Uytterhoeven
  2018-08-23 22:00   ` Nick Desaulniers
@ 2018-08-23 22:00   ` Joe Perches
  2018-12-29 14:25     ` Geert Uytterhoeven
  1 sibling, 1 reply; 13+ messages in thread
From: Joe Perches @ 2018-08-23 22:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: torvalds, Linux Kernel Mailing List, Andrew Morton, Dave Hansen,
	Mike Galbraith, Guenter Roeck, riel, Kees Cook, Nick Desaulniers,
	Jonathan Corbet, open list:DOCUMENTATION, Arnd Bergmann

On Thu, 2018-08-23 at 23:52 +0200, Geert Uytterhoeven wrote:
> Hi Joe,

Hi Geert.

> Does gcc 8.x gives again the same warnings as my venerable old gcc 4.1.2,
> that no one else seems to see? Or will the real bugs I detect this way stay
> unfixed? Polyculture is a good thing, also in compilers.

I'm not sure I understand what you mean.
Patches that fix defects and patches that fix warnings
both generally get applied.

> Reverted locally (incl. the follow-up), applied Andrew's fix, detected new
> warnings in v4.18+, and sent patches where it makes sense...

Thanks for that.

cheers, Joe

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-08-23 22:00   ` Joe Perches
@ 2018-12-29 14:25     ` Geert Uytterhoeven
  2018-12-29 21:57       ` Arnd Bergmann
  2019-01-08 14:09       ` Geert Uytterhoeven
  0 siblings, 2 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2018-12-29 14:25 UTC (permalink / raw)
  To: Joe Perches
  Cc: torvalds, Linux Kernel Mailing List, Andrew Morton, Dave Hansen,
	Mike Galbraith, Guenter Roeck, Rik van Riel, Kees Cook,
	Nick Desaulniers, Jonathan Corbet, open list:DOCUMENTATION,
	Arnd Bergmann, linux-m68k

Hi Joe,

On Fri, Aug 24, 2018 at 12:00 AM Joe Perches <joe@perches.com> wrote:
> On Thu, 2018-08-23 at 23:52 +0200, Geert Uytterhoeven wrote:
> > Does gcc 8.x gives again the same warnings as my venerable old gcc 4.1.2,
> > that no one else seems to see? Or will the real bugs I detect this way stay
> > unfixed? Polyculture is a good thing, also in compilers.
>
> I'm not sure I understand what you mean.
> Patches that fix defects and patches that fix warnings
> both generally get applied.

Sure, patches that fix bugs do get applied. But someone has to write
those patches first.  And something has to trigger writing those patches.
If gcc 4.1.2 generates warning for real issues, but newer compilers do not,
we loose one of the many detectors of issues.

> > Reverted locally (incl. the follow-up), applied Andrew's fix, detected new
> > warnings in v4.18+, and sent patches where it makes sense...
>
> Thanks for that.

Given the rise of anonymous unions all over the place, I gave up, and
have upgraded from gcc 4.1.2 to 7.3.0 for cross-compiling m68k kernels.
One good things is that the kernel size for an atari_defconfig kernel dropped
by 3.7% or 163 KiB.

For the record, below is a list of differences in generated warnings.
Note that the source trees are not identical, as the tree used with
gcc-7.3.0 did not include any workarounds I needed for gcc-4.1.2.
All warnings flagged by gcc 4.1.2 should be false positives (iff I did a
good job during the last few years ;-)

I plan to repeat the exercise with gcc-8.2.0 (after v4.21-rc1 or so).

--- build.log.linux-4.20.0-atari-07795-g835f16c9b68966ff-gcc-4.1.2-20061115-prerelease-Ubuntu-4.1.1-21
+++ build.log.linux-4.20.0-atari-07767-gc085b9fd60f52a62-gcc-7.3.0-27ubuntu1~18.04

20 warning regressions:
  + arch/m68k/atari/config.c: warning: ISO C90 forbids variable length
array ‘switches’ [-Wvla]:  => 151:2
  + arch/m68k/include/asm/cmpxchg.h: warning: value computed is not
used [-Wunused-value]:  => 79:22, 122:3, 137:3
  + arch/m68k/include/asm/raw_io.h: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]:  => 20:19, 33:35,
26:31, 30:32
  + arch/m68k/include/asm/string.h: warning: argument 2 null where
non-null expected [-Wnonnull]:  => 72:25
  + arch/m68k/kernel/setup_mm.c: warning: #warning Are you building an
allnoconfig kernel? [-Wcpp]:  => 51:2
  + arch/m68k/kernel/setup_mm.c: warning: #warning No CPU/platform
type selected, your kernel will not work! [-Wcpp]:  => 50:2
  + arch/m68k/kernel/signal.c: warning: ISO C90 forbids variable
length array ‘buf’ [-Wvla]:  => 654:3
  + arch/m68k/mvme147/config.c: warning: #warning check me! [-Wcpp]:  => 150:2
  + arch/m68k/mvme16x/config.c: warning: #warning check me! [-Wcpp]:  => 397:2
  + drivers/i2c/i2c-core-base.c: warning: ‘ret’ may be used
uninitialized in this function [-Wmaybe-uninitialized]:  => 235:5
  + drivers/input/joystick/analog.c: warning: #warning Precise timer
not defined for this architecture. [-Wcpp]:  => 172:2
  + include/linux/dynamic_debug.h: warning: statement will never be
executed [-Wswitch-unreachable]:  => 115:19
  + <stdin>: warning: #warning syscall io_pgetevents not implemented
[-Wcpp]:  => 1333:2
  + <stdin>: warning: #warning syscall pkey_alloc not implemented
[-Wcpp]:  => 1321:2
  + <stdin>: warning: #warning syscall pkey_free not implemented
[-Wcpp]:  => 1324:2
  + <stdin>: warning: #warning syscall pkey_mprotect not implemented
[-Wcpp]:  => 1318:2
  + <stdin>: warning: #warning syscall rseq not implemented [-Wcpp]:  => 1336:2
  + <stdin>: warning: #warning syscall seccomp not implemented
[-Wcpp]:  => 1240:2
  + warning: unmet direct dependencies detected for NEED_MULTIPLE_NODES:  => N/A
  + warning: unmet direct dependencies detected for SND_SOC_QDSP6:  => N/A

269 warning improvements:
  - arch/m68k/kernel/setup_mm.c: warning: #warning Are you building an
allnoconfig kernel?: 51:2 =>
  - arch/m68k/kernel/setup_mm.c: warning: #warning No CPU/platform
type selected, your kernel will not work!: 50:2 =>
  - arch/m68k/mvme147/config.c: warning: #warning check me!: 150:2 =>
  - arch/m68k/mvme16x/config.c: warning: #warning check me!: 397:2 =>
  - drivers/ata/ahci_qoriq.c: warning: ‘px_cmd’ may be used
uninitialized in this function: 86 =>
  - drivers/ata/ahci_qoriq.c: warning: ‘px_is’ may be used
uninitialized in this function: 86 =>
  - drivers/ata/libata-scsi.c: warning: ‘ncq_prio_enable’ may be used
uninitialized in this function: 283 =>
  - drivers/ata/pata_legacy.c: warning: value computed is not used:
897, 914, 285, 407, 898, 283, 302, 373, 410, 280, 409, 408, 909, 899,
286, 901, 282, 900, 374, 902, 376, 375, 284, 915 =>
  - drivers/ata/pata_legacy.c: warning: ‘r’ is used uninitialized in
this function: 1053 =>
  - drivers/base/regmap/regcache-rbtree.c: warning: ‘new_base_reg’ may
be used uninitialized in this function: 393 =>
  - drivers/base/regmap/regcache-rbtree.c: warning: ‘new_top_reg’ may
be used uninitialized in this function: 393 =>
  - drivers/block/null_blk_main.c: warning: value computed is not used: 375 =>
  - drivers/block/null_blk_main.c: warning: ‘sector’ may be used
uninitialized in this function: 1157 =>
  - drivers/block/null_blk_main.c: warning: ‘size’ may be used
uninitialized in this function: 1157 =>
  - drivers/block/paride/ppc6lnx.c: warning: cast to pointer from
integer of different size: 142, 575, 144, 560, 430, 329, 537, 266,
235, 131, 201, 147, 145, 162, 146, 217 =>
  - drivers/bluetooth/btqca.c: warning: ‘rom_ver’ may be used
uninitialized in this function: 339 =>
  - drivers/crypto/atmel-sha.c: warning: ‘keylen’ may be used
uninitialized in this function: 1757 =>
  - drivers/crypto/atmel-sha.c: warning: ‘key’ may be used
uninitialized in this function: 1758 =>
  - drivers/dma/ti/omap-dma.c: warning: ‘port_window_bytes’ may be
used uninitialized in this function: 887 =>
  - drivers/fsi/fsi-master-ast-cf.c: warning: ‘p’ may be used
uninitialized in this function: 443 =>
  - drivers/gpio/gpio-grgpio.c: warning: ‘lirq’ may be used
uninitialized in this function: 290 =>
  - drivers/gpu/drm/drm_edid.c: warning: ‘hdmi_len’ may be used
uninitialized in this function: 3720 =>
  - drivers/gpu/drm/drm_rect.c: warning: comparison is always true due
to limited range of data type: 106, 90, 114, 98 =>
  - drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c: warning: ‘sharp’
may be used uninitialized in this function: 353 =>
  - drivers/gpu/drm/selftests/drm_selftest.c: warning:
‘__drm_subtests’ defined but not used: 95 =>
  - drivers/gpu/drm/udl/udl_modeset.c: warning: ‘reg’ may be used
uninitialized in this function: 51 =>
  - drivers/hwmon/sch56xx-common.c: warning: cast to pointer from
integer of different size: 145 =>
  - drivers/hwmon/smsc47b397.c: warning: cast to pointer from integer
of different size: 119 =>
  - drivers/i2c/i2c-core-base.c: warning: ‘ret’ may be used
uninitialized in this function: 188 =>
  - drivers/i3c/master/dw-i3c-master.c: warning: comparison is always
false due to limited range of data type: 837, 973 =>
  - drivers/iio/accel/mma9551_core.c: warning: ‘pol_mask’ may be used
uninitialized in this function: 542 =>
  - drivers/iio/adc/rcar-gyroadc.c: warning: ‘ret’ may be used
uninitialized in this function: 341 =>
  - drivers/iio/adc/ti-ads8688.c: warning: ‘i’ may be used
uninitialized in this function: 300 =>
  - drivers/iio/adc/twl4030-madc.c: warning: comparison is always
false due to limited range of data type: 633 =>
  - drivers/iio/dac/ad5064.c: warning: type qualifiers ignored on
function return type: 791 =>
  - drivers/iio/light/hid-sensor-als.c: warning: ‘min’ may be used
uninitialized in this function: 96 =>
  - drivers/iio/light/hid-sensor-prox.c: warning: ‘min’ may be used
uninitialized in this function: 76 =>
  - drivers/iio/pressure/hid-sensor-press.c: warning: ‘min’ may be
used uninitialized in this function: 80 =>
  - drivers/infiniband/core/uverbs_cmd.c: warning: ‘ib_dev’ may be
used uninitialized in this function: 985, 510 =>
  - drivers/infiniband/core/uverbs_std_types.c: warning:
initialization from incompatible pointer type: 265, 232, 248, 252,
255, 228, 260, 220, 263, 235, 240, 243 =>
  - drivers/infiniband/core/uverbs_std_types_counters.c: warning:
initialization from incompatible pointer type: 135, 147, 121, 128 =>
  - drivers/infiniband/core/uverbs_std_types_cq.c: warning:
initialization from incompatible pointer type: 191, 201, 149 =>
  - drivers/infiniband/core/uverbs_std_types_dm.c: warning:
initialization from incompatible pointer type: 101, 108, 88 =>
  - drivers/infiniband/core/uverbs_std_types_flow_action.c: warning:
initialization from incompatible pointer type: 428, 404, 380, 435 =>
  - drivers/infiniband/core/uverbs_std_types_mr.c: warning:
initialization from incompatible pointer type: 117, 146 =>
  - drivers/infiniband/ulp/srpt/ib_srpt.c: warning: ‘prev_nents’ may
be used uninitialized in this function: 889 =>
  - drivers/input/joystick/analog.c: warning: #warning Precise timer
not defined for this architecture.: 172:2 =>
  - drivers/input/mouse/pc110pad.c: warning: value computed is not used: 64 =>
  - drivers/input/rmi4/rmi_driver.c: warning: comparison is always
false due to limited range of data type: 582 =>
  - drivers/input/touchscreen/htcpen.c: warning: value computed is not
used: 87, 153 =>
  - drivers/iommu/io-pgtable-arm-v7s.c: warning: ‘cptep’ may be used
uninitialized in this function: 434 =>
  - drivers/macintosh/via-pmu.c: warning: ‘gpio1_interrupt’ defined
but not used: 1707 =>
  - drivers/md/bcache/alloc.c: warning: ‘bucket’ may be used
uninitialized in this function: 331 =>
  - drivers/md/dm-stats.c: warning: ‘mult’ may be used uninitialized
in this function: 781 =>
  - drivers/md/dm-zoned-metadata.c: warning: ‘dmap’ may be used
uninitialized in this function: 1305 =>
  - drivers/md/raid10.c: warning: ‘rp_repl’ may be used uninitialized
in this function: 204 =>
  - drivers/media/cec/cec-api.c: warning: ‘ev_idx’ may be used
uninitialized in this function: 301 =>
  - drivers/media/i2c/mt9v111.c: warning: ‘new_fmt.code’ may be used
uninitialized in this function: 884 =>
  - drivers/media/platform/vicodec/codec-fwht.c: warning: ‘stat’ may
be used uninitialized in this function: 808 =>
  - drivers/media/platform/vivid/vivid-cec.c: warning: ‘bit’ may be
used uninitialized in this function: 69 =>
  - drivers/media/usb/dvb-usb/pctv452e.c: warning: value computed is
not used: 922 =>
  - drivers/mfd/lm3533-ctrlbank.c: warning: comparison is always false
due to limited range of data type: 129 =>
  - drivers/misc/altera-stapl/altera-lpt.c: warning: cast to pointer
from integer of different size: 40, 34 =>
  - drivers/mtd/nand/raw/fsmc_nand.c: warning: comparison is always
false due to limited range of data type: 324, 316, 309 =>
  - drivers/mtd/nand/raw/nand_base.c: warning: ‘best_ecc_bytes’ may be
used uninitialized in this function: 5264, 5345 =>
  - drivers/mtd/nand/raw/nand_base.c: warning: ‘best_step’ may be used
uninitialized in this function: 5264 =>
  - drivers/mtd/nand/raw/nand_base.c: warning: ‘best_strength’ may be
used uninitialized in this function: 5345, 5264 =>
  - drivers/mtd/nand/raw/vf610_nfc.c: warning: ‘offset’ may be used
uninitialized in this function: 367 =>
  - drivers/net/ethernet/8390/wd.c: warning: cast to pointer from
integer of different size: 289, 296 =>
  - drivers/net/ethernet/apm/xgene/xgene_enet_main.c: warning:
‘offset’ may be used uninitialized in this function: 431 =>
  - drivers/net/ethernet/apm/xgene/xgene_enet_main.c: warning:
‘pbuf_addr’ may be used uninitialized in this function: 424 =>
  - drivers/net/ethernet/apm/xgene/xgene_enet_main.c: warning: ‘size’
may be used uninitialized in this function: 431 =>
  - drivers/net/ethernet/broadcom/genet/bcmgenet.c: warning:
‘tx_cb_ptr’ may be used uninitialized in this function: 1551 =>
  - drivers/net/ethernet/freescale/fec_main.c: warning: ‘vlan_tag’ may
be used uninitialized in this function: 1369 =>
  - drivers/net/ethernet/freescale/fec_ptp.c: warning: ‘corr_inc’ may
be used uninitialized in this function: 293 =>
  - drivers/net/ethernet/freescale/fec_ptp.c: warning: ‘corr_period’
may be used uninitialized in this function: 293 =>
  - drivers/net/ethernet/hisilicon/hns/hns_enet.c: warning:
‘last_offset’ may be used uninitialized in this function: 424 =>
  - drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c: warning:
comparison is always false due to limited range of data type: 396 =>
  - drivers/net/ethernet/stmicro/stmmac/dwmac5.c: warning:
‘min_prio_idx’ may be used uninitialized in this function: 378 =>
  - drivers/net/ethernet/via/via-rhine.c: warning: ‘sd.dma’ may be
used uninitialized in this function: 2121 =>
  - drivers/net/gtp.c: warning: ‘pktinfo.fl4.daddr’ may be used
uninitialized in this function: 559 =>
  - drivers/net/gtp.c: warning: ‘pktinfo.fl4.saddr’ may be used
uninitialized in this function: 559 =>
  - drivers/net/gtp.c: warning: ‘pktinfo.gtph_port’ may be used
uninitialized in this function: 559 =>
  - drivers/net/gtp.c: warning: ‘pktinfo.iph’ may be used
uninitialized in this function: 559 =>
  - drivers/net/gtp.c: warning: ‘pktinfo.rt’ may be used uninitialized
in this function: 559 =>
  - drivers/net/gtp.c: warning: ‘pktinfo.sk’ may be used uninitialized
in this function: 559 =>
  - drivers/net/ieee802154/adf7242.c: warning: ‘status’ may be used
uninitialized in this function: 509 =>
  - drivers/net/macvlan.c: warning: ‘mode’ may be used uninitialized
in this function: 1483 =>
  - drivers/net/tun.c: warning: ‘copylen’ may be used uninitialized in
this function: 1757 =>
  - drivers/net/tun.c: warning: ‘linear’ may be used uninitialized in
this function: 1753 =>
  - drivers/net/wireless/ath/ath6kl/htc_pipe.c: warning: ‘packet’ may
be used uninitialized in this function: 211 =>
  - drivers/net/wireless/broadcom/b43/phy_n.c: warning: ‘idx’ may be
used uninitialized in this function: 3999 =>
  - drivers/net/wireless/broadcom/b43/phy_n.c: warning: ‘val_addr’ may
be used uninitialized in this function: 174 =>
  - drivers/net/wireless/broadcom/b43/radio_2057.c: warning: ‘size’
may be used uninitialized in this function: 541 =>
  - drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c: warning:
comparison is always false due to limited range of data type: 5432 =>
  - drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c: warning:
‘seq.head.next’ is used uninitialized in this function: 515 =>
  - drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c: warning:
‘seq.head.prev’ is used uninitialized in this function: 515 =>
  - drivers/net/wireless/ralink/rt2x00/rt2800lib.c: warning:
‘gf20_mode’ may be used uninitialized in this function: 1913 =>
  - drivers/net/wireless/ralink/rt2x00/rt2800lib.c: warning:
‘gf40_mode’ may be used uninitialized in this function: 1913 =>
  - drivers/net/wireless/ralink/rt2x00/rt2800lib.c: warning:
‘mm20_mode’ may be used uninitialized in this function: 1913 =>
  - drivers/net/wireless/ralink/rt2x00/rt2800lib.c: warning:
‘mm40_mode’ may be used uninitialized in this function: 1913 =>
  - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c: warning:
‘rf_amode’ may be used uninitialized in this function: 3438 =>
  - drivers/net/wireless/st/cw1200/scan.c: warning: value computed is
not used: 335 =>
  - drivers/net/wireless/st/cw1200/sta.c: warning: value computed is
not used: 143 =>
  - drivers/net/wireless/ti/wl1251/main.c: warning: comparison is
always true due to limited range of data type: 907 =>
  - drivers/net/wireless/ti/wl18xx/event.c: warning: comparison is
always true due to limited range of data type: 100 =>
  - drivers/net/wireless/ti/wlcore/main.c: warning: comparison is
always true due to limited range of data type: 3523 =>
  - drivers/nfc/nfcmrvl/i2c.c: warning: comparison is always false due
to limited range of data type: 52 =>
  - drivers/nfc/trf7970a.c: warning: comparison is always false due to
limited range of data type: 767 =>
  - drivers/of/overlay.c: warning: ‘fragment’ may be used
uninitialized in this function: 183 =>
  - drivers/of/unittest.c: warning: ‘overlay_base_symbols’ may be used
uninitialized in this function: 2313 =>
  - drivers/scsi/imm.c: warning: cast to pointer from integer of
different size: 563, 305, 494, 247, 473, 303, 461, 463, 486, 465, 470,
467, 341 =>
  - drivers/scsi/libfc/fc_elsct.c: warning: ‘fh_type’ may be used
uninitialized in this function: 51 =>
  - drivers/scsi/libfc/fc_elsct.c: warning: ‘r_ctl’ may be used
uninitialized in this function: 50 =>
  - drivers/scsi/ppa.c: warning: cast to pointer from integer of
different size: 439, 399, 245, 436, 379, 257 =>
  - drivers/scsi/scsi_debug.c: warning: value computed is not used: 1624 =>
  - drivers/scsi/sd.c: warning: comparison is always false due to
limited range of data type: 2472 =>
  - drivers/soc/qcom/rpmh.c: warning: ‘ret’ may be used uninitialized
in this function: 355 =>
  - drivers/soc/renesas/renesas-soc.c: warning: ‘eslo’ may be used
uninitialized in this function: 290 =>
  - drivers/spi/spi-npcm-pspi.c: warning: ‘mode_val’ may be used
uninitialized in this function: 113 =>
  - drivers/spi/spi-uniphier.c: warning: ‘val1’ may be used
uninitialized in this function: 117 =>
  - drivers/spi/spi-uniphier.c: warning: ‘val2’ may be used
uninitialized in this function: 117 =>
  - drivers/staging/comedi/drivers/pcl816.c: warning: ‘last_chan’ may
be used uninitialized in this function: 157 =>
  - drivers/staging/comedi/drivers/pcl818.c: warning: ‘last_chan’ may
be used uninitialized in this function: 347 =>
  - drivers/staging/erofs/data.c: warning: ‘last_block’ may be used
uninitialized in this function: 377 =>
  - drivers/staging/fbtft/fbtft-core.c: warning: ‘ts_start’ may be
used uninitialized in this function: 349 =>
  - drivers/staging/greybus/bootrom.c: warning: ‘offset’ may be used
uninitialized in this function: 247 =>
  - drivers/staging/greybus/bootrom.c: warning: ‘size’ may be used
uninitialized in this function: 247 =>
  - drivers/staging/rtl8188eu/hal/phy.c: warning: ‘path_a_ok’ may be
used uninitialized in this function: 954 =>
  - drivers/staging/rtl8188eu/hal/phy.c: warning: ‘path_b_ok’ may be
used uninitialized in this function: 954 =>
  - drivers/staging/rtl8712/rtl8712_recv.c: warning: ‘rx_pwr_all’ may
be used uninitialized in this function: 732 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning: previous
declaration of ‘rtw_clear_scan_deny’ was here: 618 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning: previous
declaration of ‘rtw_dec_to_roam’ was here: 681 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning: previous
declaration of ‘rtw_indicate_scan_done’ was here: 602 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning: previous
declaration of ‘rtw_set_to_roam’ was here: 680 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning: previous
declaration of ‘rtw_to_roam’ was here: 682 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning:
‘rtw_clear_scan_deny’ declared inline after being called: 618 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning:
‘rtw_dec_to_roam’ declared inline after being called: 681 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning:
‘rtw_indicate_scan_done’ declared inline after being called: 602 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning:
‘rtw_set_to_roam’ declared inline after being called: 680 =>
  - drivers/staging/rtl8723bs/include/rtw_mlme.h: warning:
‘rtw_to_roam’ declared inline after being called: 682 =>
  - drivers/target/target_core_user.c: warning: ‘dbi’ may be used
uninitialized in this function: 676 =>
  - drivers/tty/rocket_int.h: warning: cast to pointer from integer of
different size: 46, 73, 54, 68 =>
  - drivers/tty/serial/8250/8250_core.c: warning: ‘i’ may be used
uninitialized in this function: 227 =>
  - drivers/tty/serial/8250/8250_port.c: warning: ‘flags’ may be used
uninitialized in this function: 3234 =>
  - drivers/tty/serial/sh-sci.c: warning: ‘flags’ may be used
uninitialized in this function: 2969 =>
  - drivers/tty/serial/st-asc.c: warning: ‘flags’ may be used
uninitialized in this function: 881 =>
  - drivers/tty/serial/xilinx_uartps.c: warning: ‘flags’ may be used
uninitialized in this function: 1177 =>
  - drivers/tty/vt/keyboard.c: warning: comparison is always true due
to limited range of data type: 739 =>
  - drivers/usb/dwc2/gadget.c: warning: ‘flags’ may be used
uninitialized in this function: 4072 =>
  - drivers/usb/dwc2/params.c: warning: comparison is always false due
to limited range of data type: 598 =>
  - drivers/usb/gadget/function/f_hid.c: warning: comparison is always
false due to limited range of data type: 926, 925, 924 =>
  - drivers/usb/gadget/function/uvc_configfs.c: warning: comparison is
always false due to limited range of data type: 1589, 1588, 1785, 204
=>
  - drivers/usb/gadget/udc/aspeed-vhub/dev.c: warning: ‘max’ may be
used uninitialized in this function: 341 =>
  - drivers/usb/gadget/udc/bdc/bdc_core.c: warning: ‘status’ may be
used uninitialized in this function: 34 =>
  - drivers/usb/host/max3421-hcd.c: warning: ‘max3421_hcd’ may be used
uninitialized in this function: 1864 =>
  - drivers/usb/host/xhci-hub.c: warning: ‘ssa_count’ may be used
uninitialized in this function: 58 =>
  - drivers/video/fbdev/omap2/omapfb/dss/dispc.c: warning: ‘flags’ may
be used uninitialized in this function: 282 =>
  - fs/afs/dynroot.c: warning: ‘len’ may be used uninitialized in this
function: 100 =>
  - fs/btrfs/check-integrity.c: warning: ‘next_bytenr’ may be used
uninitialized in this function: 843, 2213, 678 =>
  - fs/btrfs/check-integrity.c: warning: ‘tmp_disk_key.objectid’ may
be used uninitialized in this function: 847 =>
  - fs/btrfs/extent_io.c: warning: ‘tree’ may be used uninitialized in
this function: 2486 =>
  - fs/btrfs/inode.c: warning: ‘disk_num_bytes’ may be used
uninitialized in this function: 1277 =>
  - fs/btrfs/inode.c: warning: ‘extent_offset’ may be used
uninitialized in this function: 1274 =>
  - fs/btrfs/inode.c: warning: ‘ram_bytes’ may be used uninitialized
in this function: 1278 =>
  - fs/btrfs/ref-verify.c: warning: ‘ret’ may be used uninitialized in
this function: 450, 514 =>
  - fs/btrfs/tree-log.c: warning: ‘start_slot’ may be used
uninitialized in this function: 4278 =>
  - fs/ceph/file.c: warning: value computed is not used: 831 =>
  - fs/cifs/connect.c: warning: ‘rc’ may be used uninitialized in this
function: 3960 =>
  - fs/cifs/connect.c: warning: ‘ses’ may be used uninitialized in
this function: 3962 =>
  - fs/cifs/connect.c: warning: ‘tcon’ may be used uninitialized in
this function: 3963 =>
  - fs/cifs/connect.c: warning: ‘xid’ may be used uninitialized in
this function: 3961 =>
  - fs/cifs/smbdirect.c: warning: ‘rc’ may be used uninitialized in
this function: 2113 =>
  - fs/dcache.c: warning: ‘n’ may be used uninitialized in this
function: 2709, 2544 =>
  - fs/f2fs/data.c: warning: ‘flags’ may be used uninitialized in this
function: 1341 =>
  - fs/f2fs/data.c: warning: ‘len’ may be used uninitialized in this
function: 1340 =>
  - fs/f2fs/file.c: warning: ‘err’ may be used uninitialized in this
function: 2926 =>
  - fs/f2fs/node.c: warning: ‘head’ may be used uninitialized in this
function: 237 =>
  - fs/f2fs/node.c: warning: ‘nat_blk’ may be used uninitialized in
this function: 2730 =>
  - fs/iomap.c: warning: value computed is not used: 1531 =>
  - fs/nfs/callback_xdr.c: warning: ‘op_nr’ may be used uninitialized
in this function: 880 =>
  - fs/nfs/nfs3acl.c: warning: value computed is not used: 44 =>
  - fs/nfs/nfs3proc.c: warning: value computed is not used: 798 =>
  - fs/nfsd/nfs4xdr.c: warning: ‘next’ may be used uninitialized in
this function: 2065 =>
  - fs/ocfs2/file.c: warning: value computed is not used: 2386 =>
  - fs/ocfs2/file.c: warning: ‘had_lock’ may be used uninitialized in
this function: 1136 =>
  - fs/posix_acl.c: warning: value computed is not used: 147 =>
  - fs/proc/inode.c: warning: ‘pdeo’ may be used uninitialized in this
function: 341 =>
  - fs/splice.c: warning: ‘ret’ may be used uninitialized in this
function: 695 =>
  - fs/udf/super.c: warning: ‘map’ may be used uninitialized in this
function: 1197 =>
  - fs/udf/unicode.c: warning: ‘c’ may be used uninitialized in this
function: 98 =>
  - fs/xfs/libxfs/xfs_sb.c: warning: ‘error’ may be used uninitialized
in this function: 877 =>
  - fs/xfs/scrub/repair.c: warning: ‘freelen’ may be used
uninitialized in this function: 203 =>
  - fs/xfs/scrub/repair.c: warning: ‘usedlen’ may be used
uninitialized in this function: 202 =>
  - fs/xfs/xfs_buf.c: warning: value computed is not used: 1319 =>
  - fs/xfs/xfs_log_recover.c: warning: ‘uuid’ may be used
uninitialized in this function: 2272 =>
  - include/linux/net_dim.h: warning: ‘curr_stats.bpms’ may be used
uninitialized in this function: 390 =>
  - include/linux/net_dim.h: warning: ‘curr_stats.epms’ may be used
uninitialized in this function: 390 =>
  - include/linux/net_dim.h: warning: ‘curr_stats.ppms’ may be used
uninitialized in this function: 390 =>
  - include/linux/sbitmap.h: warning: value computed is not used: 491 =>
  - include/linux/sunrpc/xdr.h: warning: ‘len’ may be used
uninitialized in this function: 480, 512 =>
  - ipc/shm.c: warning: ‘file’ may be used uninitialized in this
function: 1608 =>
  - ipc/util.c: warning: comparison is always false due to limited
range of data type: 220 =>
  - kernel/acct.c: warning: value computed is not used: 177 =>
  - kernel/bpf/verifier.c: warning: ‘prev_offset’ may be used
uninitialized in this function: 4813 =>
  - kernel/cgroup/cgroup-v1.c: warning: ‘root’ may be used
uninitialized in this function: 1114 =>
  - kernel/printk/printk.c: warning: ‘old’ may be used uninitialized
in this function: 161 =>
  - kernel/time/timekeeping.c: warning: comparison is always false due
to limited range of data type: 2298, 2300 =>
  - kernel/time/timekeeping.c: warning: ‘cs_was_changed_seq’ may be
used uninitialized in this function: 1124 =>
  - lib/assoc_array.c: warning: ‘j’ may be used uninitialized in this
function: 490 =>
  - lib/errseq.c: warning: value computed is not used: 200 =>
  - lib/mpi/mpicoder.c: warning: ‘buff’ may be used uninitialized in
this function: 336 =>
  - lib/rhashtable.c: warning: ‘next’ may be used uninitialized in
this function: 229 =>
  - lib/sbitmap.c: warning: value computed is not used: 451 =>
  - lib/test_overflow.c: warning: comparison is always false due to
limited range of data type: 415, 327, 328, 383, 330, 449, 381, 324,
453, 353, 425, 452, 413, 439, 323, 326, 448, 367, 329, 437, 366, 325,
427, 352 =>
  - mm/ksm.c: warning: ‘found_rmap_hlist_len’ may be used
uninitialized in this function: 1367 =>
  - mm/ksm.c: warning: ‘stable_node’ may be used uninitialized in this
function: 1808 =>
  - mm/memcontrol.c: warning: value computed is not used: 1047 =>
  - mm/page-writeback.c: warning: ‘filepages’ is used uninitialized in
this function: 1952, 1624 =>
  - mm/page-writeback.c: warning: ‘headroom’ is used uninitialized in
this function: 1952, 1624 =>
  - mm/page-writeback.c: warning: ‘writeback’ is used uninitialized in
this function: 1623 =>
  - mm/page_isolation.c: warning: ‘order’ may be used uninitialized in
this function: 96 =>
  - mm/shmem.c: warning: comparison is always false due to limited
range of data type: 1604 =>
  - mm/zswap.c: warning: ‘ret’ may be used uninitialized in this
function: 860 =>
  - net/batman-adv/netlink.c: warning: ‘msg_head’ may be used
uninitialized in this function: 337, 196 =>
  - net/bluetooth/l2cap_core.c: warning: comparison is always false
due to limited range of data type: 3820 =>
  - net/bridge/br_netlink.c: warning: ‘err’ may be used uninitialized
in this function: 591 =>
  - net/ceph/ceph_fs.c: warning: ‘mode’ may be used uninitialized in
this function: 59 =>
  - net/core/dev.c: warning: ‘tail’ may be used uninitialized in this
function: 3389 =>
  - net/core/filter.c: warning: value computed is not used: 3469 =>
  - net/core/rtnetlink.c: warning: ‘ivvl[0]’ may be used uninitialized
in this function: 2214 =>
  - net/core/sock.c: warning: value computed is not used: 1003 =>
  - net/hsr/hsr_device.c: warning: ‘hsr_tag’ may be used uninitialized
in this function: 259 =>
  - net/ieee802154/6lowpan/rx.c: warning: comparison is always true
due to limited range of data type: 251 =>
  - net/ieee802154/nl802154.c: warning: ‘wpan_dev_id’ may be used
uninitialized in this function: 49 =>
  - net/ipv4/ipmr.c: warning: ‘uc’ may be used uninitialized in this
function: 1224 =>
  - net/ipv4/tcp_bbr.c: warning: value computed is not used: 935 =>
  - net/ipv4/tcp_input.c: warning: ‘last_ackt’ may be used
uninitialized in this function: 3049 =>
  - net/ipv6/ip6mr.c: warning: ‘uc’ may be used uninitialized in this
function: 1405 =>
  - net/mac80211/ht.c: warning: ‘smps_mode’ may be used uninitialized
in this function: 141 =>
  - net/mac80211/mesh_pathtbl.c: warning: ‘mpath’ may be used
uninitialized in this function: 417 =>
  - net/mac80211/mlme.c: warning: ‘pwr_level_80211h’ may be used
uninitialized in this function: 1479 =>
  - net/mac80211/tdls.c: warning: ‘subband_start’ may be used
uninitialized in this function: 78 =>
  - net/mac80211/tx.c: warning: ‘chanctx_conf’ may be used
uninitialized in this function: 2452 =>
  - net/ncsi/ncsi-manage.c: warning: ‘vid’ is used uninitialized in
this function: 661 =>
  - net/ncsi/ncsi-netlink.c: warning: ‘channel_id’ may be used
uninitialized in this function: 275 =>
  - net/netfilter/nf_conntrack_core.c: warning: ‘bucket’ may be used
uninitialized in this function: 1078 =>
  - net/sunrpc/xprtrdma/svc_rdma_recvfrom.c: warning: ‘position’ may
be used uninitialized in this function: 398 =>
  - net/tipc/socket.c: warning: ‘copy’ may be used uninitialized in
this function: 1734 =>
  - net/tls/tls_sw.c: warning: ‘control’ may be used uninitialized in
this function: 1479 =>
  - net/wireless/nl80211.c: warning: ‘wdev_id’ may be used
uninitialized in this function: 71 =>
  - security/apparmor/policy_unpack.c: warning: ‘pos’ may be used
uninitialized in this function: 467 =>
  - sound/firewire/motu/amdtp-motu.c: warning: ‘copy_message’ defined
but not used: 288 =>
  - sound/firewire/motu/amdtp-motu.c: warning: ‘copy_sph’ defined but
not used: 274 =>
  - sound/soc/codecs/arizona.c: warning: ‘aif_rx_state’ may be used
uninitialized in this function: 1793 =>
  - sound/soc/codecs/arizona.c: warning: ‘aif_tx_state’ may be used
uninitialized in this function: 1793 =>
  - sound/soc/codecs/da7219-aad.c: warning: ‘pll_ctrl’ may be used
uninitialized in this function: 121 =>
  - sound/soc/codecs/rt5665.c: warning: ‘val1’ may be used
uninitialized in this function: 2634 =>
  - sound/soc/codecs/rt5665.c: warning: ‘val2’ may be used
uninitialized in this function: 2634 =>
  - sound/soc/codecs/wm8996.c: warning: ‘bclk_reg’ may be used
uninitialized in this function: 1538 =>
  - sound/soc/xtensa/xtfpga-i2s.c: warning: value computed is not used: 172 =>
  - <stdin>: warning: #warning syscall  LD [M]
net/netfilter/xt_iprange.ko: 1240:2 =>
  - <stdin>: warning: #warning syscall io_pgetevents not implemented: 1333:2 =>
  - <stdin>: warning: #warning syscall pkey_alloc not implemented: 1321:2 =>
  - <stdin>: warning: #warning syscall pkey_free not implemented: 1324:2 =>
  - <stdin>: warning: #warning syscall pkey_mprotect not implemented: 1318:2 =>
  - <stdin>: warning: #warning syscall rseq not implemented: 1336:2 =>
  - <stdin>: warning: #warning syscall seccomp not implemented: 1240:2 =>
  - {standard input}: Warning: expression out of range: defaulting to
0: 2955, 2956 =>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-12-29 14:25     ` Geert Uytterhoeven
@ 2018-12-29 21:57       ` Arnd Bergmann
  2019-01-08 14:09       ` Geert Uytterhoeven
  1 sibling, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2018-12-29 21:57 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Joe Perches, torvalds, Linux Kernel Mailing List, Andrew Morton,
	Dave Hansen, Mike Galbraith, Guenter Roeck, Rik van Riel,
	Kees Cook, Nick Desaulniers, Jonathan Corbet,
	open list:DOCUMENTATION, linux-m68k

On Sat, Dec 29, 2018 at 3:25 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> On Fri, Aug 24, 2018 at 12:00 AM Joe Perches <joe@perches.com> wrote:
> > On Thu, 2018-08-23 at 23:52 +0200, Geert Uytterhoeven wrote:
> --- build.log.linux-4.20.0-atari-07795-g835f16c9b68966ff-gcc-4.1.2-20061115-prerelease-Ubuntu-4.1.1-21
> +++ build.log.linux-4.20.0-atari-07767-gc085b9fd60f52a62-gcc-7.3.0-27ubuntu1~18.04
>
> 20 warning regressions:
>   + arch/m68k/atari/config.c: warning: ISO C90 forbids variable length
> array ‘switches’ [-Wvla]:  => 151:2

Ah, so we still have some of these. The warning was only recently added.

>   + arch/m68k/include/asm/cmpxchg.h: warning: value computed is not
> used [-Wunused-value]:  => 79:22, 122:3, 137:3

IIRC this can be avoided using a ({ ... }) type expression.

>   + arch/m68k/include/asm/raw_io.h: warning: cast to pointer from
> integer of different size [-Wint-to-pointer-cast]:  => 20:19, 33:35,
> 26:31, 30:32

The I/O accessors are defined in an unusual way that defeats a lot
of the type checking we normally have. Generally speaking the
memory space operations (readl/ioread32/__raw_readl, ...) should
be inline functions taking a 'const volatile void __iomem *' argument
(non-const for writel), while the I/O space operations should take
an integer port number (16 or 32 bit, depending on how your ISA
or PCI buses work).

Doing that should avoid all the warnings you quote here, but may
introduce warnings about nonportable driver code.

>   + arch/m68k/include/asm/string.h: warning: argument 2 null where
> non-null expected [-Wnonnull]:  => 72:25

This might be a kernel bug.

>   + arch/m68k/kernel/setup_mm.c: warning: #warning Are you building an
> allnoconfig kernel? [-Wcpp]:  => 51:2
>   + arch/m68k/kernel/setup_mm.c: warning: #warning No CPU/platform
> type selected, your kernel will not work! [-Wcpp]:  => 50:2
>   + arch/m68k/mvme147/config.c: warning: #warning check me! [-Wcpp]:  => 150:2
>   + arch/m68k/mvme16x/config.c: warning: #warning check me! [-Wcpp]:  => 397:2

I've removed that kind of warning from other architectures.

>   + arch/m68k/kernel/signal.c: warning: ISO C90 forbids variable
> length array ‘buf’ [-Wvla]:  => 654:3

You can probably pick the maximum here.

>   + drivers/i2c/i2c-core-base.c: warning: ‘ret’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]:  => 235:5

This might come from the new CONFIG_NO_AUTO_INLINE.

>   + drivers/input/joystick/analog.c: warning: #warning Precise timer
> not defined for this architecture. [-Wcpp]:  => 172:2

Maybe add a Kconfig dependency on !M68K?

>   + include/linux/dynamic_debug.h: warning: statement will never be
> executed [-Wswitch-unreachable]:  => 115:19

No idea.

>   + warning: unmet direct dependencies detected for NEED_MULTIPLE_NODES:  => N/A
>   + warning: unmet direct dependencies detected for SND_SOC_QDSP6:  => N/A

Not gcc warnings.

      Arnd

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Raise the minimum required gcc version to 4.6
  2018-12-29 14:25     ` Geert Uytterhoeven
  2018-12-29 21:57       ` Arnd Bergmann
@ 2019-01-08 14:09       ` Geert Uytterhoeven
  1 sibling, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2019-01-08 14:09 UTC (permalink / raw)
  To: Joe Perches
  Cc: torvalds, Linux Kernel Mailing List, Andrew Morton, Dave Hansen,
	Mike Galbraith, Guenter Roeck, Rik van Riel, Kees Cook,
	Nick Desaulniers, Jonathan Corbet, open list:DOCUMENTATION,
	Arnd Bergmann, linux-m68k

On Sat, Dec 29, 2018 at 3:25 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Fri, Aug 24, 2018 at 12:00 AM Joe Perches <joe@perches.com> wrote:
> > On Thu, 2018-08-23 at 23:52 +0200, Geert Uytterhoeven wrote:
> > > Reverted locally (incl. the follow-up), applied Andrew's fix, detected new
> > > warnings in v4.18+, and sent patches where it makes sense...
> >
> > Thanks for that.
>
> Given the rise of anonymous unions all over the place, I gave up, and
> have upgraded from gcc 4.1.2 to 7.3.0 for cross-compiling m68k kernels.
> One good things is that the kernel size for an atari_defconfig kernel dropped
> by 3.7% or 163 KiB.
>
> For the record, below is a list of differences in generated warnings.
> Note that the source trees are not identical, as the tree used with
> gcc-7.3.0 did not include any workarounds I needed for gcc-4.1.2.
> All warnings flagged by gcc 4.1.2 should be false positives (iff I did a
> good job during the last few years ;-)
>
> I plan to repeat the exercise with gcc-8.2.0 (after v4.21-rc1 or so).

As promised, gcc-7.3.0 => gcc-8.2.0:

    *** ERRORS ***

    4 error regressions:
      + error: devfreq.c: undefined reference to `strcmp':  => .text+0x9c6)
      + error: ldm.c: undefined reference to `strcmp':  =>
.text+0x1900), .text+0x1964), .text+0x19a0), .text+0x193c)
      + error: proc.c: undefined reference to `strcmp':  =>
.text+0x18c), .text+0x178)
      + error: xattr.c: undefined reference to `strcmp':  =>
.text+0xbaa), .text+0xbf0), .text+0x2e8), .text+0x268), .text+0x97a),
.text+0x9be), .text+0x3d4)

Hmm, time to fix the auto-strncmp-to-strcmp-conversion for good...

    *** WARNINGS ***

    1 warning regressions:
      + drivers/dio/dio.c: warning: ‘strcpy’ writing 69 or more bytes
into a region of size 64 overflows the destination
[-Wstringop-overflow=]:  => 240:17

That's a nice one, it found a 15 year old bug. Patch sent ;-)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-01-08 14:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20 20:15 [PATCH] Raise the minimum required gcc version to 4.6 Joe Perches
2018-08-20 20:25 ` Nick Desaulniers
2018-08-20 20:42 ` Jonathan Corbet
2018-08-20 20:48   ` Joe Perches
2018-08-21  6:55 ` Masahiro Yamada
2018-08-21 19:40   ` Linus Torvalds
2018-08-21 23:41     ` Nick Desaulniers
2018-08-23 21:52 ` Geert Uytterhoeven
2018-08-23 22:00   ` Nick Desaulniers
2018-08-23 22:00   ` Joe Perches
2018-12-29 14:25     ` Geert Uytterhoeven
2018-12-29 21:57       ` Arnd Bergmann
2019-01-08 14:09       ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).