Skip to contentSkip to conversation

New: GCC12: printk.h:446:44: error: using a dangling pointer to '__str'

Bug 216090 [email protected] 1 participant 4 messages Jun 7, 2022 – Jul 29, 2022

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=216090

Bug ID: 216090
Summary: GCC12: printk.h:446:44: error: using a dangling
pointer to '__str'
Product: Platform Specific/Hardware
Version: 2.5
Kernel Version: 5.17.13
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: PPC-64
Assignee: [email protected]
Reporter: [email protected]
Regression: Yes

There is build error on GCC 12:

[00:00:26] CC arch/powerpc/kernel/trace/ftrace.o
[00:00:26] In file included from ./include/asm-generic/bug.h:22,

  [00:00:26]                  from ./arch/powerpc/include/asm/bug.h:149,
  [00:00:26]                  from ./include/linux/bug.h:5,
  [00:00:26]                  from ./include/linux/thread_info.h:13,
  [00:00:26]                  from ./include/asm-generic/preempt.h:5,
  [00:00:26]                  from
./arch/powerpc/include/generated/asm/preempt.h:1,
  [00:00:26]                  from ./include/linux/preempt.h:78,
  [00:00:26]                  from ./include/linux/spinlock.h:55,
  [00:00:26]                  from arch/powerpc/kernel/trace/ftrace.c:16:

[00:00:26] arch/powerpc/kernel/trace/ftrace.c: In function
'ftrace_modify_code':
[00:00:26] ./include/linux/printk.h:446:44: error: using a dangling pointer
to '__str' [-Werror=dangling-pointer=]
[00:00:26] 446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt,
##__VA_ARGS__)
[00:00:26] | ^
[00:00:26] ./include/linux/printk.h:418:17: note: in definition of macro
'printk_index_wrap'

  [00:00:26]   418 |                 _p_func(_fmt, ##__VA_ARGS__);             
             \
  [00:00:26]       |                 ^~~~~~~
  [00:00:26] ./include/linux/printk.h:489:9: note: in expansion of macro
'printk'
  [00:00:26]   489 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
  [00:00:26]       |         ^~~~~~
  [00:00:26] arch/powerpc/kernel/trace/ftrace.c:76:17: note: in expansion of
macro 'pr_err'
  [00:00:26]    76 |                 pr_err("%p: replaced (%s) != old (%s)",
  [00:00:26]       |                 ^~~~~~

[00:00:26] In file included from
./arch/powerpc/include/asm/code-patching.h:14,
[00:00:26] from arch/powerpc/kernel/trace/ftrace.c:27:
[00:00:26] ./arch/powerpc/include/asm/inst.h:156:14: note: '__str' declared
here
[00:00:26] 156 | char __str[PPC_INST_STR_LEN]; \
[00:00:26] | ^~~~~
[00:00:26] ./include/linux/printk.h:418:33: note: in expansion of macro
'ppc_inst_as_str'

  [00:00:26]   418 |                 _p_func(_fmt, ##__VA_ARGS__);             
             \

[00:00:26] | ^~~~~~~~~~~
[00:00:26] ./include/linux/printk.h:446:26: note: in expansion of macro
'printk_index_wrap'
[00:00:26] 446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt,
##__VA_ARGS__)

This may be related discussion:
https://lore.kernel.org/all/[email protected]/T/

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 216090] GCC12: printk.h:446:44: error: using a dangling pointer to '__str'

https://bugzilla.kernel.org/show_bug.cgi?id=216090

Artem S. Tashkinov ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|---                         |ANSWERED

--- Comment #1 from Artem S. Tashkinov ([email protected]) ---
Linux kernel developers are well aware of the regressions related to GCC 12.x. Patches are being worked on.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#2 lore raw

[Bug 216090] GCC12: printk.h:446:44: error: using a dangling pointer to '__str'

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=216090

Michael Ellerman ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

                 CC|                            |[email protected]
         Resolution|ANSWERED                    |CODE_FIX

--- Comment #2 from Michael Ellerman ([email protected]) --- Fixed in 2a83afe72a2b ("powerpc/64: Drop ppc_inst_as_str()").

The warning has also been disabled in 49beadbd47c2 ("gcc-12: disable '-Wdangling-pointer' warning for now").

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#3 lore raw

[Bug 216090] GCC12: printk.h:446:44: error: using a dangling pointer to '__str'

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=216090

Michael Ellerman ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.