[Bug c++/70649] New: [6 Regression] Incorrect C++ warning on zero-sized array passing
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Apr 14 00:34:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70649
Bug ID: 70649
Summary: [6 Regression] Incorrect C++ warning on zero-sized
array passing
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
CC: jason at redhat dot com
Target Milestone: ---
[hjl@gnu-6 pr60336d]$ cat x.i
struct dummy0 { int i; };
struct dummy { struct dummy0 d[0]; };
extern void fun(struct dummy, int);
void
foo (void)
{
struct dummy d;
fun(d, 1);
}
[hjl@gnu-6 pr60336d]$ g++ -S -Wabi=9 x.i
[hjl@gnu-6 pr60336d]$ cat x.s
.file "x.i"
.text
.globl _Z3foov
.type _Z3foov, @function
_Z3foov:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $1, %edi
call _Z3fun5dummyi
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size _Z3foov, .-_Z3foov
.ident "GCC: (GNU) 5.3.1 20160406 (Red Hat 5.3.1-6)"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 pr60336d]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xg++
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -S -Wabi=9 x.i
x.i: In function ‘void foo()’:
x.i:8:12: warning: call to ‘fun’: empty class ‘dummy’ parameter passing ABI
changes in -fabi-version=10 (GCC 6) [-Wabi]
fun(d, 1);
^
[hjl@gnu-6 pr60336d]$ cat x.s
.file "x.i"
.text
.globl _Z3foov
.type _Z3foov, @function
_Z3foov:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $1, %edi
call _Z3fun5dummyi
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size _Z3foov, .-_Z3foov
.ident "GCC: (GNU) 6.0.0 20160413 (experimental)"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 pr60336d]$
The warning is incorrect since there is no change in zero-sized array passing.
More information about the Gcc-bugs
mailing list