public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 2/6] c: Turn int-conversion warnings into permerrors
@ 2023-12-02  0:33 钟居哲
  2023-12-02  1:10 ` Patrick O'Neill
  2023-12-02  1:13 ` Sam James
  0 siblings, 2 replies; 14+ messages in thread
From: 钟居哲 @ 2023-12-02  0:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: thomas, fweimer

[-- Attachment #1: Type: text/plain, Size: 22009 bytes --]

Hi, This patch cause error on building newlib/glibc/musl on RISC-V port:

/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
      |                                        ^~~~
      |                                        |
      |                                        const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_utime.c:5:39: warning: 'struct utimbuf' declared inside parameter list will not be visible outside of this definition or declaration
    5 | _utime(const char *path, const struct utimbuf *times)
      |                                       ^~~~~~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_faccessat.c: In function '_faccessat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_faccessat.c:7:50: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    7 |   return syscall_errno (SYS_faccessat, 4, dirfd, file, mode, flags, 0, 0);
      |                                                  ^~~~
      |                                                  |
      |                                                  const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_faccessat.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
make[5]: *** [Makefile:3315: riscv/riscv_libgloss_a-sys_access.o] Error 1
make[5]: *** Waiting for unfinished jobs....
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_open.c: In function '_open':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_open.c:8:38: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_open, 3, name, flags, mode, 0, 0, 0);
      |                                      ^~~~
      |                                      |
      |                                      const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_open.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_openat.c: In function '_openat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_openat.c:7:47: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    7 |   return syscall_errno (SYS_openat, 4, dirfd, name, flags, mode, 0, 0);
      |                                               ^~~~
      |                                               |
      |                                               const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_openat.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
make[5]: *** [Makefile:3427: riscv/riscv_libgloss_a-sys_faccessat.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c: In function '_link':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c:7:38: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    7 |   return syscall_errno (SYS_link, 2, old_name, new_name, 0, 0, 0, 0);
      |                                      ^~~~~~~~
      |                                      |
      |                                      const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c:7:48: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    7 |   return syscall_errno (SYS_link, 2, old_name, new_name, 0, 0, 0, 0);
      |                                                ^~~~~~~~
      |                                                |
      |                                                const char *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstat.c: In function '_fstat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstat.c:12:47: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   12 |   int rv = syscall_errno (SYS_fstat, 2, file, &kst, 0, 0, 0, 0);
      |                                               ^~~~
      |                                               |
      |                                               struct kernel_stat *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstat.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'struct kernel_stat *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c: In function '_fstatat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c:11:50: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   11 |   int rv = syscall_errno (SYS_fstatat, 4, dirfd, file, &kst, flags, 0, 0);
      |                                                  ^~~~
      |                                                  |
      |                                                  const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c:11:56: error: passing argument 5 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   11 |   int rv = syscall_errno (SYS_fstatat, 4, dirfd, file, &kst, flags, 0, 0);
      |                                                        ^~~~
      |                                                        |
      |                                                        struct kernel_stat *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_unlink.c: In function '_unlink':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:58: note: expected 'long int' but argument is of type 'struct kernel_stat *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                                     ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_unlink.c:8:40: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_unlink, 1, name, 0, 0, 0, 0, 0);
      |                                        ^~~~
      |                                        |
      |                                        const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_unlink.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c: In function '_access':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
      |                                        ^~~~
      |                                        |
      |                                        const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_read.c: In function '_read':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_read.c:8:44: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_read, 3, file, ptr, len, 0, 0, 0);
      |                                            ^~~
      |                                            |
      |                                            void *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_read.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'void *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
make[5]: *** [Makefile:3609: riscv/riscv_libgloss_a-sys_open.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c: In function '_lstat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c:10:41: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   10 |   int rv = syscall_errno (SYS_lstat, 2, file, &kst, 0, 0, 0, 0);
      |                                         ^~~~
      |                                         |
      |                                         const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c:10:47: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   10 |   int rv = syscall_errno (SYS_lstat, 2, file, &kst, 0, 0, 0, 0);
      |                                               ^~~~
      |                                               |
      |                                               struct kernel_stat *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'struct kernel_stat *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_write.c: In function '_write':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_write.c:9:45: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    9 |   return syscall_errno (SYS_write, 3, file, ptr, len, 0, 0, 0);
      |                                             ^~~
      |                                             |
      |                                             const void *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_write.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const void *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c: In function '_stat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c:11:40: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   11 |   int rv = syscall_errno (SYS_stat, 2, file, &kst, 0, 0, 0, 0);
      |                                        ^~~~
      |                                        |
      |                                        const char *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_gettimeofday.c: In function '_gettimeofday':
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c:11:46: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   11 |   int rv = syscall_errno (SYS_stat, 2, file, &kst, 0, 0, 0, 0);
      |                                              ^~~~
      |                                              |
      |                                              struct kernel_stat *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_gettimeofday.c:29:46: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   29 |   return syscall_errno (SYS_gettimeofday, 1, tp, 0, 0, 0, 0, 0);
      |                                              ^~
      |                                              |
      |                                              struct timeval *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'struct kernel_stat *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_gettimeofday.c:4:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'struct timeval *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
make[5]: *** [Makefile:3623: riscv/riscv_libgloss_a-sys_openat.o] Error 1
make[5]: *** [Makefile:3567: riscv/riscv_libgloss_a-sys_link.o] Error 1
make[5]: *** [Makefile:3455: riscv/riscv_libgloss_a-sys_fstat.o] Error 1
make[5]: *** [Makefile:3469: riscv/riscv_libgloss_a-sys_fstatat.o] Error 1
make[5]: *** [Makefile:3707: riscv/riscv_libgloss_a-sys_unlink.o] Error 1
make[5]: *** [Makefile:4127: riscv/riscv_libsim_a-sys_access.o] Error 1
make[5]: *** [Makefile:3637: riscv/riscv_libgloss_a-sys_read.o] Error 1
make[5]: *** [Makefile:3595: riscv/riscv_libgloss_a-sys_lstat.o] Error 1
make[5]: *** [Makefile:3749: riscv/riscv_libgloss_a-sys_write.o] Error 1
make[5]: *** [Makefile:3665: riscv/riscv_libgloss_a-sys_stat.o] Error 1
make[5]: *** [Makefile:3525: riscv/riscv_libgloss_a-sys_gettimeofday.o] Error 1




juzhe.zhong@rivai.ai

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-02  0:33 [PATCH 2/6] c: Turn int-conversion warnings into permerrors 钟居哲
@ 2023-12-02  1:10 ` Patrick O'Neill
  2023-12-02  1:53   ` 钟居哲
  2023-12-02  1:13 ` Sam James
  1 sibling, 1 reply; 14+ messages in thread
From: Patrick O'Neill @ 2023-12-02  1:10 UTC (permalink / raw)
  To: 钟居哲, gcc-patches; +Cc: thomas, fweimer

[-- Attachment #1: Type: text/plain, Size: 24331 bytes --]

Hi Juzhe,

I can confirm the failure on Newlib.
I'm not seeing any issues on glibc 2.37.
I haven't tried to build musl.

Since this patch promotes warnings to errors breakages were probably 
expected.
The fix may require changes to newlib to remove the errors.
I've hacked together a series of patches on top of newlib 4.3.0 that 
resolves these issues (but I think they'd need more work to be 
upstream-able):
https://github.com/patrick-rivos/riscv-gnu-toolchain/tree/35d8e8c486bd2f6e3e2e673db8d2b979309a6de4/fixups/newlib

@Thomas @Florian am I right in assuming that breakages were expected/the 
fix should come from fixing the warnings?

Thanks,
Patrick

On 12/1/23 16:33, 钟居哲 wrote:
> Hi, This patch cause error on building newlib/glibc/musl on RISC-V port:
>
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40: 
> error: passing argument 3 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
>       |                                        ^~~~
>       |                                        |
>       |                                        const char *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:2:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                 ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_utime.c:5:39: 
> warning: 'struct utimbuf' declared inside parameter list will not be 
> visible outside of this definition or declaration
>     5 | _utime(const char *path, const struct utimbuf *times)
>       |                                       ^~~~~~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_faccessat.c: 
> In function '_faccessat':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_faccessat.c:7:50: 
> error: passing argument 4 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     7 |   return syscall_errno (SYS_faccessat, 4, dirfd, file, mode, 
> flags, 0, 0);
>       | ^~~~
>       |                                                  |
>       | const char *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_faccessat.c:2:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                           ~~~~~^~~
> make[5]: *** [Makefile:3315: riscv/riscv_libgloss_a-sys_access.o] Error 1
> make[5]: *** Waiting for unfinished jobs....
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_open.c: 
> In function '_open':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_open.c:8:38: 
> error: passing argument 3 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     8 |   return syscall_errno (SYS_open, 3, name, flags, mode, 0, 0, 0);
>       |                                      ^~~~
>       |                                      |
>       |                                      const char *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_open.c:2:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                 ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_openat.c: 
> In function '_openat':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_openat.c:7:47: 
> error: passing argument 4 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     7 |   return syscall_errno (SYS_openat, 4, dirfd, name, flags, 
> mode, 0, 0);
>       |                                               ^~~~
>       |                                               |
>       |                                               const char *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_openat.c:2:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                           ~~~~~^~~
> make[5]: *** [Makefile:3427: riscv/riscv_libgloss_a-sys_faccessat.o] 
> Error 1
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c: 
> In function '_link':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c:7:38: 
> error: passing argument 3 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     7 |   return syscall_errno (SYS_link, 2, old_name, new_name, 0, 0, 
> 0, 0);
>       |                                      ^~~~~~~~
>       |                                      |
>       |                                      const char *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c:2:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                 ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c:7:48: 
> error: passing argument 4 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     7 |   return syscall_errno (SYS_link, 2, old_name, new_name, 0, 0, 
> 0, 0);
>       | ^~~~~~~~
>       |                                                |
>       | const char *
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                           ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstat.c: 
> In function '_fstat':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstat.c:12:47: 
> error: passing argument 4 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>    12 |   int rv = syscall_errno (SYS_fstat, 2, file, &kst, 0, 0, 0, 0);
>       |                                               ^~~~
>       |                                               |
>       |  struct kernel_stat *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstat.c:3:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: 
> note: expected 'long int' but argument is of type 'struct kernel_stat *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                           ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c: 
> In function '_fstatat':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c:11:50: 
> error: passing argument 4 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>    11 |   int rv = syscall_errno (SYS_fstatat, 4, dirfd, file, &kst, 
> flags, 0, 0);
>       | ^~~~
>       |                                                  |
>       | const char *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c:3:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                           ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c:11:56: 
> error: passing argument 5 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>    11 |   int rv = syscall_errno (SYS_fstatat, 4, dirfd, file, &kst, 
> flags, 0, 0);
>       |     ^~~~
>       |     |
>       |     struct kernel_stat *
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_unlink.c: 
> In function '_unlink':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:58: 
> note: expected 'long int' but argument is of type 'struct kernel_stat *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |  ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_unlink.c:8:40: 
> error: passing argument 3 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     8 |   return syscall_errno (SYS_unlink, 1, name, 0, 0, 0, 0, 0);
>       |                                        ^~~~
>       |                                        |
>       |                                        const char *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_unlink.c:2:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                 ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c: 
> In function '_access':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40: 
> error: passing argument 3 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
>       |                                        ^~~~
>       |                                        |
>       |                                        const char *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:2:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                 ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_read.c: 
> In function '_read':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_read.c:8:44: 
> error: passing argument 4 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     8 |   return syscall_errno (SYS_read, 3, file, ptr, len, 0, 0, 0);
>       |                                            ^~~
>       |                                            |
>       |                                            void *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_read.c:3:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: 
> note: expected 'long int' but argument is of type 'void *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                           ~~~~~^~~
> make[5]: *** [Makefile:3609: riscv/riscv_libgloss_a-sys_open.o] Error 1
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c: 
> In function '_lstat':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c:10:41: 
> error: passing argument 3 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>    10 |   int rv = syscall_errno (SYS_lstat, 2, file, &kst, 0, 0, 0, 0);
>       |                                         ^~~~
>       |                                         |
>       |                                         const char *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c:3:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                 ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c:10:47: 
> error: passing argument 4 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>    10 |   int rv = syscall_errno (SYS_lstat, 2, file, &kst, 0, 0, 0, 0);
>       |                                               ^~~~
>       |                                               |
>       |  struct kernel_stat *
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: 
> note: expected 'long int' but argument is of type 'struct kernel_stat *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                           ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_write.c: 
> In function '_write':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_write.c:9:45: 
> error: passing argument 4 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>     9 |   return syscall_errno (SYS_write, 3, file, ptr, len, 0, 0, 0);
>       |                                             ^~~
>       |                                             |
>       |                                             const void *
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_write.c:3:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: 
> note: expected 'long int' but argument is of type 'const void *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                           ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c: 
> In function '_stat':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c:11:40: 
> error: passing argument 3 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>    11 |   int rv = syscall_errno (SYS_stat, 2, file, &kst, 0, 0, 0, 0);
>       |                                        ^~~~
>       |                                        |
>       |                                        const char *
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_gettimeofday.c: 
> In function '_gettimeofday':
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c:3:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: 
> note: expected 'long int' but argument is of type 'const char *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                 ~~~~~^~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c:11:46: 
> error: passing argument 4 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>    11 |   int rv = syscall_errno (SYS_stat, 2, file, &kst, 0, 0, 0, 0);
>       |                                              ^~~~
>       |                                              |
>       |                                              struct kernel_stat *
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_gettimeofday.c:29:46: 
> error: passing argument 3 of 'syscall_errno' makes integer from 
> pointer without a cast [-Wint-conversion]
>    29 |   return syscall_errno (SYS_gettimeofday, 1, tp, 0, 0, 0, 0, 0);
>       |                                              ^~
>       |                                              |
>       |                                              struct timeval *
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: 
> note: expected 'long int' but argument is of type 'struct kernel_stat *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                           ~~~~~^~~
> In file included from 
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_gettimeofday.c:4:
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: 
> note: expected 'long int' but argument is of type 'struct timeval *'
>    66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, 
> long _a3, long _a4, long _a5)
>       |                                 ~~~~~^~~
> make[5]: *** [Makefile:3623: riscv/riscv_libgloss_a-sys_openat.o] Error 1
> make[5]: *** [Makefile:3567: riscv/riscv_libgloss_a-sys_link.o] Error 1
> make[5]: *** [Makefile:3455: riscv/riscv_libgloss_a-sys_fstat.o] Error 1
> make[5]: *** [Makefile:3469: riscv/riscv_libgloss_a-sys_fstatat.o] Error 1
> make[5]: *** [Makefile:3707: riscv/riscv_libgloss_a-sys_unlink.o] Error 1
> make[5]: *** [Makefile:4127: riscv/riscv_libsim_a-sys_access.o] Error 1
> make[5]: *** [Makefile:3637: riscv/riscv_libgloss_a-sys_read.o] Error 1
> make[5]: *** [Makefile:3595: riscv/riscv_libgloss_a-sys_lstat.o] Error 1
> make[5]: *** [Makefile:3749: riscv/riscv_libgloss_a-sys_write.o] Error 1
> make[5]: *** [Makefile:3665: riscv/riscv_libgloss_a-sys_stat.o] Error 1
> make[5]: *** [Makefile:3525: 
> riscv/riscv_libgloss_a-sys_gettimeofday.o] Error 1
>
>
> ------------------------------------------------------------------------
> juzhe.zhong@rivai.ai

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-02  0:33 [PATCH 2/6] c: Turn int-conversion warnings into permerrors 钟居哲
  2023-12-02  1:10 ` Patrick O'Neill
@ 2023-12-02  1:13 ` Sam James
  2023-12-02  3:40   ` Jeff Law
  1 sibling, 1 reply; 14+ messages in thread
From: Sam James @ 2023-12-02  1:13 UTC (permalink / raw)
  To: 钟居哲; +Cc: thomas, fweimer, gcc-patches


钟居哲 <juzhe.zhong@rivai.ai> writes:

> Hi, This patch cause error on building newlib/glibc/musl on RISC-V port:
>
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40:
> error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
>     8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
>       |                                        ^~~~
>       |                                        |
>       |                                        const char *

This looks like an issue in newlib. We expect broken code to be broken
by the recent changes. Can you investigate it on the newlib side?

Thanks.


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

* Re: Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-02  1:10 ` Patrick O'Neill
@ 2023-12-02  1:53   ` 钟居哲
  2023-12-02  3:25     ` Patrick O'Neill
  0 siblings, 1 reply; 14+ messages in thread
From: 钟居哲 @ 2023-12-02  1:53 UTC (permalink / raw)
  To: patrick, gcc-patches; +Cc: thomas, fweimer

[-- Attachment #1: Type: text/plain, Size: 44776 bytes --]

No. GLIBC 2.37 also failed:

make[4]: Leaving directory '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib/riscv64-unknown-elf/newlib'
  CC       libm/complex/libm_a-casinhl.o
make[3]: *** [Makefile:5283: all] Error 2
make[3]: Leaving directory '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib/riscv64-unknown-elf/newlib'
make[2]: *** [Makefile:8492: all-target-newlib] Error 2
make[2]: Leaving directory '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib'
make[1]: *** [Makefile:879: all] Error 2
make[1]: Leaving directory '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib'
make: *** [Makefile:624: stamps/build-newlib] Error 2
make: *** Waiting for unfinished jobs....
  CC       libm/complex/libm_a-csinhl.o
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c: In function 'ccoshl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c:43:13: error: implicit declaration of function 'coshl'; did you mean 'coshf'? [-Wimplicit-function-declaration]
   43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
      |             ^~~~~
      |             coshf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c:43:24: error: implicit declaration of function 'cosl'; did you mean 'cosf'? [-Wimplicit-function-declaration]
   43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
      |                        ^~~~
      |                        cosf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/clogl.c: In function 'clogl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c:43:35: error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? [-Wimplicit-function-declaration]
   43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
      |                                   ^~~~~
      |                                   sinhf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/clogl.c:42:13: error: implicit declaration of function 'logl'; did you mean 'logf'? [-Wimplicit-function-declaration]
   42 |         p = logl(rr);
      |             ^~~~
      |             logf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c:43:46: error: implicit declaration of function 'sinl'; did you mean 'sinf'? [-Wimplicit-function-declaration]
   43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
      |                                              ^~~~
      |                                              sinf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/clogl.c:43:14: error: implicit declaration of function 'atan2l'; did you mean 'atan2f'? [-Wimplicit-function-declaration]
   43 |         rr = atan2l(cimagl(z), creall(z));
      |              ^~~~~~
      |              atan2f
  CC       libm/complex/libm_a-csinl.o
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cexpl.c: In function 'cexpl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cexpl.c:43:13: error: implicit declaration of function 'expl'; did you mean 'expf'? [-Wimplicit-function-declaration]
   43 |         r = expl(x);
      |             ^~~~
      |             expf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cexpl.c:44:17: error: implicit declaration of function 'cosl'; did you mean 'cosf'? [-Wimplicit-function-declaration]
   44 |         w = r * cosl(y) + r * sinl(y) * I;
      |                 ^~~~
      |                 cosf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cexpl.c:44:31: error: implicit declaration of function 'sinl'; did you mean 'sinf'? [-Wimplicit-function-declaration]
   44 |         w = r * cosl(y) + r * sinl(y) * I;
      |                               ^~~~
      |                               sinf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c: In function '_cchshl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c:43:13: error: implicit declaration of function 'fabsl'; did you mean 'fabsf'? [-Wimplicit-function-declaration]
   43 |         if (fabsl(x) <= 0.5L) {
      |             ^~~~~
      |             fabsf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cargl.c: In function 'cargl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cargl.c:16:17: error: implicit declaration of function 'atan2l'; did you mean 'atan2f'? [-Wimplicit-function-declaration]
   16 |          return atan2l (cimagl (z), creall (z));
      |                 ^~~~~~
      |                 atan2f
  CC       libm/complex/libm_a-catanl.o
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c:44:22: error: implicit declaration of function 'coshl'; did you mean 'coshf'? [-Wimplicit-function-declaration]
   44 |                 *c = coshl(x);
      |                      ^~~~~
      |                      coshf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c:45:22: error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? [-Wimplicit-function-declaration]
   45 |                 *s = sinhl(x);
      |                      ^~~~~
      |                      sinhf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c: In function 'csqrtl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c:80:40: error: implicit declaration of function 'fabsl'; did you mean 'fabsf'? [-Wimplicit-function-declaration]
   80 |                         return (cpackl(fabsl(b - b), copysignl(a, b)));
      |                                        ^~~~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c:50:24: note: in definition of macro 'cpackl'
   50 | #define cpackl(r, i) ((r) + (i) * I)
      |                        ^
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c:47:21: error: implicit declaration of function 'expl'; did you mean 'expf'? [-Wimplicit-function-declaration]
   47 |                 e = expl(x);
      |                     ^~~~
      |                     expf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c:80:54: error: implicit declaration of function 'copysignl'; did you mean 'copysignf'? [-Wimplicit-function-declaration]
   80 |                         return (cpackl(fabsl(b - b), copysignl(a, b)));
      |                                                      ^~~~~~~~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c:50:30: note: in definition of macro 'cpackl'
   50 | #define cpackl(r, i) ((r) + (i) * I)
      |                              ^
  CC       libm/fenv/libm_a-feclearexcept.o
  CC       libm/fenv/libm_a-fe_dfl_env.o
  CC       libm/fenv/libm_a-fegetenv.o
  CC       libm/fenv/libm_a-fegetexceptflag.o
make[4]: *** [Makefile:43116: libm/complex/libm_a-ccoshl.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: *** [Makefile:43144: libm/complex/libm_a-clogl.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cprojl.c: In function 'cprojl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cprojl.c:60:32: error: implicit declaration of function 'copysignl'; did you mean 'copysignf'? [-Wimplicit-function-declaration]
   60 |                 IMAG_PART(w) = copysignl(0.0L, cimagl(z));
      |                                ^~~~~~~~~
      |                                copysignf
make[4]: *** [Makefile:43200: libm/complex/libm_a-cexpl.o] Error 1
make[4]: *** [Makefile:43172: libm/complex/libm_a-cargl.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccosl.c: In function 'ccosl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccosl.c:43:13: error: implicit declaration of function 'cosl'; did you mean 'cosf'? [-Wimplicit-function-declaration]
   43 |         w = cosl(creall(z)) * ch - (sinl(creall(z)) * sh) * I;
      |             ^~~~
      |             cosf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccosl.c:43:37: error: implicit declaration of function 'sinl'; did you mean 'sinf'? [-Wimplicit-function-declaration]
   43 |         w = cosl(creall(z)) * ch - (sinl(creall(z)) * sh) * I;
      |                                     ^~~~
      |                                     sinf
make[4]: *** [Makefile:43214: libm/complex/libm_a-cephes_subrl.o] Error 1
make[4]: *** [Makefile:43158: libm/complex/libm_a-csqrtl.o] Error 1
make[4]: *** [Makefile:43186: libm/complex/libm_a-cprojl.o] Error 1
make[4]: *** [Makefile:43242: libm/complex/libm_a-ccosl.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c: In function 'cpowl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:48:13: error: implicit declaration of function 'powl'; did you mean 'powf'? [-Wimplicit-function-declaration]
   48 |         r = powl(absa, x);
      |             ^~~~
      |             powf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c: In function 'ctanhl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c:43:13: error: implicit declaration of function 'coshl'; did you mean 'coshf'? [-Wimplicit-function-declaration]
   43 |         d = coshl(2.0L * x) + cosl(2.0L * y);
      |             ^~~~~
      |             coshf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:51:25: error: implicit declaration of function 'expl'; did you mean 'expf'? [-Wimplicit-function-declaration]
   51 |                 r = r * expl(-y * arga);
      |                         ^~~~
      |                         expf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c:43:31: error: implicit declaration of function 'cosl'; did you mean 'cosf'? [-Wimplicit-function-declaration]
   43 |         d = coshl(2.0L * x) + cosl(2.0L * y);
      |                               ^~~~
      |                               cosf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:52:37: error: implicit declaration of function 'logl'; did you mean 'logf'? [-Wimplicit-function-declaration]
   52 |                 theta = theta + y * logl(absa);
      |                                     ^~~~
      |                                     logf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c:44:13: error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? [-Wimplicit-function-declaration]
   44 |         w = sinhl(2.0L * x) / d  +  (sinl(2.0L * y) / d) * I;
      |             ^~~~~
      |             sinhf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:54:17: error: implicit declaration of function 'cosl'; did you mean 'cosf'? [-Wimplicit-function-declaration]
   54 |         w = r * cosl(theta) + (r * sinl(theta)) * I;
      |                 ^~~~
      |                 cosf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c:44:38: error: implicit declaration of function 'sinl'; did you mean 'sinf'? [-Wimplicit-function-declaration]
   44 |         w = sinhl(2.0L * x) / d  +  (sinl(2.0L * y) / d) * I;
      |                                      ^~~~
      |                                      sinf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:54:36: error: implicit declaration of function 'sinl'; did you mean 'sinf'? [-Wimplicit-function-declaration]
   54 |         w = r * cosl(theta) + (r * sinl(theta)) * I;
      |                                    ^~~~
      |                                    sinf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c: In function 'ctanl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:43:13: error: implicit declaration of function 'cosl'; did you mean 'cosf'? [-Wimplicit-function-declaration]
   43 |         d = cosl(2.0L * creall(z)) + coshl(2.0L * cimagl(z));
      |             ^~~~
      |             cosf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:43:38: error: implicit declaration of function 'coshl'; did you mean 'coshf'? [-Wimplicit-function-declaration]
   43 |         d = cosl(2.0L * creall(z)) + coshl(2.0L * cimagl(z));
      |                                      ^~~~~
      |                                      coshf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:45:13: error: implicit declaration of function 'fabsl'; did you mean 'fabsf'? [-Wimplicit-function-declaration]
   45 |         if (fabsl(d) < 0.25L)
      |             ^~~~~
      |             fabsf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:54:13: error: implicit declaration of function 'sinl'; did you mean 'sinf'? [-Wimplicit-function-declaration]
   54 |         w = sinl(2.0L * creall(z)) / d + (sinhl(2.0L * cimagl(z)) / d) * I;
      |             ^~~~
      |             sinf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:54:43: error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? [-Wimplicit-function-declaration]
   54 |         w = sinl(2.0L * creall(z)) / d + (sinhl(2.0L * cimagl(z)) / d) * I;
      |                                           ^~~~~
      |                                           sinhf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c: In function 'csinhl':
make[4]: *** [Makefile:43312: libm/complex/libm_a-ctanhl.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c:43:13: error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? [-Wimplicit-function-declaration]
   43 |         w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
      |             ^~~~~
      |             sinhf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c:43:24: error: implicit declaration of function 'cosl'; did you mean 'cosf'? [-Wimplicit-function-declaration]
   43 |         w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
      |                        ^~~~
      |                        cosf
make[4]: *** [Makefile:43298: libm/complex/libm_a-cpowl.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c:43:35: error: implicit declaration of function 'coshl'; did you mean 'coshf'? [-Wimplicit-function-declaration]
   43 |         w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
      |                                   ^~~~~
      |                                   coshf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c:43:46: error: implicit declaration of function 'sinl'; did you mean 'sinf'? [-Wimplicit-function-declaration]
   43 |         w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
      |                                              ^~~~
      |                                              sinf
make[4]: *** [Makefile:43326: libm/complex/libm_a-ctanl.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinl.c: In function 'csinl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinl.c:43:13: error: implicit declaration of function 'sinl'; did you mean 'sinf'? [-Wimplicit-function-declaration]
   43 |         w = sinl(creall(z)) * ch + (cosl(creall(z)) * sh) * I;
      |             ^~~~
      |             sinf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinl.c:43:37: error: implicit declaration of function 'cosl'; did you mean 'cosf'? [-Wimplicit-function-declaration]
   43 |         w = sinl(creall(z)) * ch + (cosl(creall(z)) * sh) * I;
      |                                     ^~~~
      |                                     cosf
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/catanl.c: In function 'catanl':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/catanl.c:55:20: error: implicit declaration of function 'atan2l'; did you mean 'atan2f'? [-Wimplicit-function-declaration]
   55 |         t = 0.5L * atan2l(2.0L * x, a);
      |                    ^~~~~~
      |                    atan2f
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/catanl.c:65:26: error: implicit declaration of function 'logl'; did you mean 'logf'? [-Wimplicit-function-declaration]
   65 |         w = w + (0.25L * logl(a)) * I;
      |                          ^~~~
      |                          logf
make[4]: *** [Makefile:43354: libm/complex/libm_a-csinhl.o] Error 1
make[4]: *** [Makefile:43368: libm/complex/libm_a-csinl.o] Error 1
make[4]: *** [Makefile:43382: libm/complex/libm_a-catanl.o] Error 1
make[4]: Leaving directory '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib-nano/riscv64-unknown-elf/newlib'
make[3]: *** [Makefile:5283: all] Error 2
make[3]: Leaving directory '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib-nano/riscv64-unknown-elf/newlib'
make[2]: *** [Makefile:8492: all-target-newlib] Error 2
make[2]: Leaving directory '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib-nano'
make[1]: *** [Makefile:879: all] Error 2
make[1]: Leaving directory '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib-nano'
make: *** [Makefile:641: stamps/build-newlib-nano] Error 2

Confirm newlib/glibc/musl definitely can not be compiled by trunk GCC.



juzhe.zhong@rivai.ai
 
From: Patrick O'Neill
Date: 2023-12-02 09:10
To: 钟居哲; gcc-patches
CC: thomas; fweimer
Subject: Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
Hi Juzhe,

I can confirm the failure on Newlib.
I'm not seeing any issues on glibc 2.37.
I haven't tried to build musl.

Since this patch promotes warnings to errors breakages were probably expected.
The fix may require changes to newlib to remove the errors.
I've hacked together a series of patches on top of newlib 4.3.0 that resolves these issues (but I think they'd need more work to be upstream-able):
https://github.com/patrick-rivos/riscv-gnu-toolchain/tree/35d8e8c486bd2f6e3e2e673db8d2b979309a6de4/fixups/newlib

@Thomas @Florian am I right in assuming that breakages were expected/the fix should come from fixing the warnings?

Thanks,
Patrick
On 12/1/23 16:33, 钟居哲 wrote:
Hi, This patch cause error on building newlib/glibc/musl on RISC-V port:

/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
      |                                        ^~~~
      |                                        |
      |                                        const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_utime.c:5:39: warning: 'struct utimbuf' declared inside parameter list will not be visible outside of this definition or declaration
    5 | _utime(const char *path, const struct utimbuf *times)
      |                                       ^~~~~~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_faccessat.c: In function '_faccessat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_faccessat.c:7:50: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    7 |   return syscall_errno (SYS_faccessat, 4, dirfd, file, mode, flags, 0, 0);
      |                                                  ^~~~
      |                                                  |
      |                                                  const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_faccessat.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
make[5]: *** [Makefile:3315: riscv/riscv_libgloss_a-sys_access.o] Error 1
make[5]: *** Waiting for unfinished jobs....
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_open.c: In function '_open':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_open.c:8:38: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_open, 3, name, flags, mode, 0, 0, 0);
      |                                      ^~~~
      |                                      |
      |                                      const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_open.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_openat.c: In function '_openat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_openat.c:7:47: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    7 |   return syscall_errno (SYS_openat, 4, dirfd, name, flags, mode, 0, 0);
      |                                               ^~~~
      |                                               |
      |                                               const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_openat.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
make[5]: *** [Makefile:3427: riscv/riscv_libgloss_a-sys_faccessat.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c: In function '_link':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c:7:38: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    7 |   return syscall_errno (SYS_link, 2, old_name, new_name, 0, 0, 0, 0);
      |                                      ^~~~~~~~
      |                                      |
      |                                      const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_link.c:7:48: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    7 |   return syscall_errno (SYS_link, 2, old_name, new_name, 0, 0, 0, 0);
      |                                                ^~~~~~~~
      |                                                |
      |                                                const char *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstat.c: In function '_fstat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstat.c:12:47: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   12 |   int rv = syscall_errno (SYS_fstat, 2, file, &kst, 0, 0, 0, 0);
      |                                               ^~~~
      |                                               |
      |                                               struct kernel_stat *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstat.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'struct kernel_stat *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c: In function '_fstatat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c:11:50: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   11 |   int rv = syscall_errno (SYS_fstatat, 4, dirfd, file, &kst, flags, 0, 0);
      |                                                  ^~~~
      |                                                  |
      |                                                  const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_fstatat.c:11:56: error: passing argument 5 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   11 |   int rv = syscall_errno (SYS_fstatat, 4, dirfd, file, &kst, flags, 0, 0);
      |                                                        ^~~~
      |                                                        |
      |                                                        struct kernel_stat *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_unlink.c: In function '_unlink':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:58: note: expected 'long int' but argument is of type 'struct kernel_stat *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                                     ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_unlink.c:8:40: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_unlink, 1, name, 0, 0, 0, 0, 0);
      |                                        ^~~~
      |                                        |
      |                                        const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_unlink.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c: In function '_access':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
      |                                        ^~~~
      |                                        |
      |                                        const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:2:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_read.c: In function '_read':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_read.c:8:44: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    8 |   return syscall_errno (SYS_read, 3, file, ptr, len, 0, 0, 0);
      |                                            ^~~
      |                                            |
      |                                            void *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_read.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'void *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
make[5]: *** [Makefile:3609: riscv/riscv_libgloss_a-sys_open.o] Error 1
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c: In function '_lstat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c:10:41: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   10 |   int rv = syscall_errno (SYS_lstat, 2, file, &kst, 0, 0, 0, 0);
      |                                         ^~~~
      |                                         |
      |                                         const char *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_lstat.c:10:47: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   10 |   int rv = syscall_errno (SYS_lstat, 2, file, &kst, 0, 0, 0, 0);
      |                                               ^~~~
      |                                               |
      |                                               struct kernel_stat *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'struct kernel_stat *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_write.c: In function '_write':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_write.c:9:45: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
    9 |   return syscall_errno (SYS_write, 3, file, ptr, len, 0, 0, 0);
      |                                             ^~~
      |                                             |
      |                                             const void *
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_write.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'const void *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c: In function '_stat':
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c:11:40: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   11 |   int rv = syscall_errno (SYS_stat, 2, file, &kst, 0, 0, 0, 0);
      |                                        ^~~~
      |                                        |
      |                                        const char *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_gettimeofday.c: In function '_gettimeofday':
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c:3:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'const char *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_stat.c:11:46: error: passing argument 4 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   11 |   int rv = syscall_errno (SYS_stat, 2, file, &kst, 0, 0, 0, 0);
      |                                              ^~~~
      |                                              |
      |                                              struct kernel_stat *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_gettimeofday.c:29:46: error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
   29 |   return syscall_errno (SYS_gettimeofday, 1, tp, 0, 0, 0, 0, 0);
      |                                              ^~
      |                                              |
      |                                              struct timeval *
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:48: note: expected 'long int' but argument is of type 'struct kernel_stat *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                           ~~~~~^~~
In file included from /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_gettimeofday.c:4:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/internal_syscall.h:66:38: note: expected 'long int' but argument is of type 'struct timeval *'
   66 | syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
      |                                 ~~~~~^~~
make[5]: *** [Makefile:3623: riscv/riscv_libgloss_a-sys_openat.o] Error 1
make[5]: *** [Makefile:3567: riscv/riscv_libgloss_a-sys_link.o] Error 1
make[5]: *** [Makefile:3455: riscv/riscv_libgloss_a-sys_fstat.o] Error 1
make[5]: *** [Makefile:3469: riscv/riscv_libgloss_a-sys_fstatat.o] Error 1
make[5]: *** [Makefile:3707: riscv/riscv_libgloss_a-sys_unlink.o] Error 1
make[5]: *** [Makefile:4127: riscv/riscv_libsim_a-sys_access.o] Error 1
make[5]: *** [Makefile:3637: riscv/riscv_libgloss_a-sys_read.o] Error 1
make[5]: *** [Makefile:3595: riscv/riscv_libgloss_a-sys_lstat.o] Error 1
make[5]: *** [Makefile:3749: riscv/riscv_libgloss_a-sys_write.o] Error 1
make[5]: *** [Makefile:3665: riscv/riscv_libgloss_a-sys_stat.o] Error 1
make[5]: *** [Makefile:3525: riscv/riscv_libgloss_a-sys_gettimeofday.o] Error 1




juzhe.zhong@rivai.ai

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-02  1:53   ` 钟居哲
@ 2023-12-02  3:25     ` Patrick O'Neill
  0 siblings, 0 replies; 14+ messages in thread
From: Patrick O'Neill @ 2023-12-02  3:25 UTC (permalink / raw)
  To: 钟居哲, gcc-patches; +Cc: thomas, fweimer

[-- Attachment #1: Type: text/plain, Size: 24458 bytes --]

That failure is is due to newlib files:
/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../*newlib*/newlib/libm/complex/ccoshl.c: 
In function 'ccoshl':

To build gcc w/ glibc with riscv-gnu-toolchain, run make linux.

A temporary fix for newlib is here:
https://github.com/patrick-rivos/riscv-gnu-toolchain/tree/35d8e8c486bd2f6e3e2e673db8d2b979309a6de4/fixups/newlib

On 12/1/23 17:53, 钟居哲 wrote:
> No. GLIBC 2.37 also failed:
>
> make[4]: Leaving directory 
> '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib/riscv64-unknown-elf/newlib'
>   CC       libm/complex/libm_a-casinhl.o
> make[3]: *** [Makefile:5283: all] Error 2
> make[3]: Leaving directory 
> '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib/riscv64-unknown-elf/newlib'
> make[2]: *** [Makefile:8492: all-target-newlib] Error 2
> make[2]: Leaving directory 
> '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib'
> make[1]: *** [Makefile:879: all] Error 2
> make[1]: Leaving directory 
> '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib'
> make: *** [Makefile:624: stamps/build-newlib] Error 2
> make: *** Waiting for unfinished jobs....
>   CC       libm/complex/libm_a-csinhl.o
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c: 
> In function 'ccoshl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c:43:13: 
> error: implicit declaration of function 'coshl'; did you mean 'coshf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
>       |             ^~~~~
>       |             coshf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c:43:24: 
> error: implicit declaration of function 'cosl'; did you mean 'cosf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
>       |                        ^~~~
>       |                        cosf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/clogl.c: 
> In function 'clogl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c:43:35: 
> error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
>       |                                   ^~~~~
>       |                                   sinhf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/clogl.c:42:13: 
> error: implicit declaration of function 'logl'; did you mean 'logf'? 
> [-Wimplicit-function-declaration]
>    42 |         p = logl(rr);
>       |             ^~~~
>       |             logf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccoshl.c:43:46: 
> error: implicit declaration of function 'sinl'; did you mean 'sinf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
>       |                                              ^~~~
>       |                                              sinf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/clogl.c:43:14: 
> error: implicit declaration of function 'atan2l'; did you mean 
> 'atan2f'? [-Wimplicit-function-declaration]
>    43 |         rr = atan2l(cimagl(z), creall(z));
>       |              ^~~~~~
>       |              atan2f
>   CC       libm/complex/libm_a-csinl.o
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cexpl.c: 
> In function 'cexpl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cexpl.c:43:13: 
> error: implicit declaration of function 'expl'; did you mean 'expf'? 
> [-Wimplicit-function-declaration]
>    43 |         r = expl(x);
>       |             ^~~~
>       |             expf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cexpl.c:44:17: 
> error: implicit declaration of function 'cosl'; did you mean 'cosf'? 
> [-Wimplicit-function-declaration]
>    44 |         w = r * cosl(y) + r * sinl(y) * I;
>       |                 ^~~~
>       |                 cosf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cexpl.c:44:31: 
> error: implicit declaration of function 'sinl'; did you mean 'sinf'? 
> [-Wimplicit-function-declaration]
>    44 |         w = r * cosl(y) + r * sinl(y) * I;
>       |                               ^~~~
>       |                               sinf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c: 
> In function '_cchshl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c:43:13: 
> error: implicit declaration of function 'fabsl'; did you mean 'fabsf'? 
> [-Wimplicit-function-declaration]
>    43 |         if (fabsl(x) <= 0.5L) {
>       |             ^~~~~
>       |             fabsf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cargl.c: 
> In function 'cargl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cargl.c:16:17: 
> error: implicit declaration of function 'atan2l'; did you mean 
> 'atan2f'? [-Wimplicit-function-declaration]
>    16 |          return atan2l (cimagl (z), creall (z));
>       |                 ^~~~~~
>       |                 atan2f
>   CC       libm/complex/libm_a-catanl.o
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c:44:22: 
> error: implicit declaration of function 'coshl'; did you mean 'coshf'? 
> [-Wimplicit-function-declaration]
>    44 |                 *c = coshl(x);
>       |                      ^~~~~
>       |                      coshf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c:45:22: 
> error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? 
> [-Wimplicit-function-declaration]
>    45 |                 *s = sinhl(x);
>       |                      ^~~~~
>       |                      sinhf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c: 
> In function 'csqrtl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c:80:40: 
> error: implicit declaration of function 'fabsl'; did you mean 'fabsf'? 
> [-Wimplicit-function-declaration]
>    80 |                         return (cpackl(fabsl(b - b), 
> copysignl(a, b)));
>       |                                        ^~~~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c:50:24: 
> note: in definition of macro 'cpackl'
>    50 | #define cpackl(r, i) ((r) + (i) * I)
>       |                        ^
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cephes_subrl.c:47:21: 
> error: implicit declaration of function 'expl'; did you mean 'expf'? 
> [-Wimplicit-function-declaration]
>    47 |                 e = expl(x);
>       |                     ^~~~
>       |                     expf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c:80:54: 
> error: implicit declaration of function 'copysignl'; did you mean 
> 'copysignf'? [-Wimplicit-function-declaration]
>    80 |                         return (cpackl(fabsl(b - b), 
> copysignl(a, b)));
>       |   ^~~~~~~~~
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csqrtl.c:50:30: 
> note: in definition of macro 'cpackl'
>    50 | #define cpackl(r, i) ((r) + (i) * I)
>       |                              ^
>   CC       libm/fenv/libm_a-feclearexcept.o
>   CC       libm/fenv/libm_a-fe_dfl_env.o
>   CC       libm/fenv/libm_a-fegetenv.o
>   CC       libm/fenv/libm_a-fegetexceptflag.o
> make[4]: *** [Makefile:43116: libm/complex/libm_a-ccoshl.o] Error 1
> make[4]: *** Waiting for unfinished jobs....
> make[4]: *** [Makefile:43144: libm/complex/libm_a-clogl.o] Error 1
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cprojl.c: 
> In function 'cprojl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cprojl.c:60:32: 
> error: implicit declaration of function 'copysignl'; did you mean 
> 'copysignf'? [-Wimplicit-function-declaration]
>    60 |                 IMAG_PART(w) = copysignl(0.0L, cimagl(z));
>       |                                ^~~~~~~~~
>       |                                copysignf
> make[4]: *** [Makefile:43200: libm/complex/libm_a-cexpl.o] Error 1
> make[4]: *** [Makefile:43172: libm/complex/libm_a-cargl.o] Error 1
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccosl.c: 
> In function 'ccosl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccosl.c:43:13: 
> error: implicit declaration of function 'cosl'; did you mean 'cosf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = cosl(creall(z)) * ch - (sinl(creall(z)) * sh) * I;
>       |             ^~~~
>       |             cosf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ccosl.c:43:37: 
> error: implicit declaration of function 'sinl'; did you mean 'sinf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = cosl(creall(z)) * ch - (sinl(creall(z)) * sh) * I;
>       |                                     ^~~~
>       |                                     sinf
> make[4]: *** [Makefile:43214: libm/complex/libm_a-cephes_subrl.o] Error 1
> make[4]: *** [Makefile:43158: libm/complex/libm_a-csqrtl.o] Error 1
> make[4]: *** [Makefile:43186: libm/complex/libm_a-cprojl.o] Error 1
> make[4]: *** [Makefile:43242: libm/complex/libm_a-ccosl.o] Error 1
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c: 
> In function 'cpowl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:48:13: 
> error: implicit declaration of function 'powl'; did you mean 'powf'? 
> [-Wimplicit-function-declaration]
>    48 |         r = powl(absa, x);
>       |             ^~~~
>       |             powf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c: 
> In function 'ctanhl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c:43:13: 
> error: implicit declaration of function 'coshl'; did you mean 'coshf'? 
> [-Wimplicit-function-declaration]
>    43 |         d = coshl(2.0L * x) + cosl(2.0L * y);
>       |             ^~~~~
>       |             coshf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:51:25: 
> error: implicit declaration of function 'expl'; did you mean 'expf'? 
> [-Wimplicit-function-declaration]
>    51 |                 r = r * expl(-y * arga);
>       |                         ^~~~
>       |                         expf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c:43:31: 
> error: implicit declaration of function 'cosl'; did you mean 'cosf'? 
> [-Wimplicit-function-declaration]
>    43 |         d = coshl(2.0L * x) + cosl(2.0L * y);
>       |                               ^~~~
>       |                               cosf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:52:37: 
> error: implicit declaration of function 'logl'; did you mean 'logf'? 
> [-Wimplicit-function-declaration]
>    52 |                 theta = theta + y * logl(absa);
>       |                                     ^~~~
>       |                                     logf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c:44:13: 
> error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? 
> [-Wimplicit-function-declaration]
>    44 |         w = sinhl(2.0L * x) / d  +  (sinl(2.0L * y) / d) * I;
>       |             ^~~~~
>       |             sinhf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:54:17: 
> error: implicit declaration of function 'cosl'; did you mean 'cosf'? 
> [-Wimplicit-function-declaration]
>    54 |         w = r * cosl(theta) + (r * sinl(theta)) * I;
>       |                 ^~~~
>       |                 cosf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanhl.c:44:38: 
> error: implicit declaration of function 'sinl'; did you mean 'sinf'? 
> [-Wimplicit-function-declaration]
>    44 |         w = sinhl(2.0L * x) / d  +  (sinl(2.0L * y) / d) * I;
>       |                                      ^~~~
>       |                                      sinf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/cpowl.c:54:36: 
> error: implicit declaration of function 'sinl'; did you mean 'sinf'? 
> [-Wimplicit-function-declaration]
>    54 |         w = r * cosl(theta) + (r * sinl(theta)) * I;
>       |                                    ^~~~
>       |                                    sinf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c: 
> In function 'ctanl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:43:13: 
> error: implicit declaration of function 'cosl'; did you mean 'cosf'? 
> [-Wimplicit-function-declaration]
>    43 |         d = cosl(2.0L * creall(z)) + coshl(2.0L * cimagl(z));
>       |             ^~~~
>       |             cosf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:43:38: 
> error: implicit declaration of function 'coshl'; did you mean 'coshf'? 
> [-Wimplicit-function-declaration]
>    43 |         d = cosl(2.0L * creall(z)) + coshl(2.0L * cimagl(z));
>       |                                      ^~~~~
>       |                                      coshf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:45:13: 
> error: implicit declaration of function 'fabsl'; did you mean 'fabsf'? 
> [-Wimplicit-function-declaration]
>    45 |         if (fabsl(d) < 0.25L)
>       |             ^~~~~
>       |             fabsf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:54:13: 
> error: implicit declaration of function 'sinl'; did you mean 'sinf'? 
> [-Wimplicit-function-declaration]
>    54 |         w = sinl(2.0L * creall(z)) / d + (sinhl(2.0L * 
> cimagl(z)) / d) * I;
>       |             ^~~~
>       |             sinf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/ctanl.c:54:43: 
> error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? 
> [-Wimplicit-function-declaration]
>    54 |         w = sinl(2.0L * creall(z)) / d + (sinhl(2.0L * 
> cimagl(z)) / d) * I;
>       |                                           ^~~~~
>       |                                           sinhf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c: 
> In function 'csinhl':
> make[4]: *** [Makefile:43312: libm/complex/libm_a-ctanhl.o] Error 1
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c:43:13: 
> error: implicit declaration of function 'sinhl'; did you mean 'sinhf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
>       |             ^~~~~
>       |             sinhf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c:43:24: 
> error: implicit declaration of function 'cosl'; did you mean 'cosf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
>       |                        ^~~~
>       |                        cosf
> make[4]: *** [Makefile:43298: libm/complex/libm_a-cpowl.o] Error 1
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c:43:35: 
> error: implicit declaration of function 'coshl'; did you mean 'coshf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
>       |                                   ^~~~~
>       |                                   coshf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinhl.c:43:46: 
> error: implicit declaration of function 'sinl'; did you mean 'sinf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
>       |                                              ^~~~
>       |                                              sinf
> make[4]: *** [Makefile:43326: libm/complex/libm_a-ctanl.o] Error 1
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinl.c: 
> In function 'csinl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinl.c:43:13: 
> error: implicit declaration of function 'sinl'; did you mean 'sinf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = sinl(creall(z)) * ch + (cosl(creall(z)) * sh) * I;
>       |             ^~~~
>       |             sinf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/csinl.c:43:37: 
> error: implicit declaration of function 'cosl'; did you mean 'cosf'? 
> [-Wimplicit-function-declaration]
>    43 |         w = sinl(creall(z)) * ch + (cosl(creall(z)) * sh) * I;
>       |                                     ^~~~
>       |                                     cosf
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/catanl.c: 
> In function 'catanl':
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/catanl.c:55:20: 
> error: implicit declaration of function 'atan2l'; did you mean 
> 'atan2f'? [-Wimplicit-function-declaration]
>    55 |         t = 0.5L * atan2l(2.0L * x, a);
>       |                    ^~~~~~
>       |                    atan2f
> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/../../newlib/newlib/libm/complex/catanl.c:65:26: 
> error: implicit declaration of function 'logl'; did you mean 'logf'? 
> [-Wimplicit-function-declaration]
>    65 |         w = w + (0.25L * logl(a)) * I;
>       |                          ^~~~
>       |                          logf
> make[4]: *** [Makefile:43354: libm/complex/libm_a-csinhl.o] Error 1
> make[4]: *** [Makefile:43368: libm/complex/libm_a-csinl.o] Error 1
> make[4]: *** [Makefile:43382: libm/complex/libm_a-catanl.o] Error 1
> make[4]: Leaving directory 
> '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib-nano/riscv64-unknown-elf/newlib'
> make[3]: *** [Makefile:5283: all] Error 2
> make[3]: Leaving directory 
> '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib-nano/riscv64-unknown-elf/newlib'
> make[2]: *** [Makefile:8492: all-target-newlib] Error 2
> make[2]: Leaving directory 
> '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib-nano'
> make[1]: *** [Makefile:879: all] Error 2
> make[1]: Leaving directory 
> '/work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-linux-spike-debug/build-newlib-nano'
> make: *** [Makefile:641: stamps/build-newlib-nano] Error 2
>
> Confirm newlib/glibc/musl definitely can not be compiled by trunk GCC.
>

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-02  1:13 ` Sam James
@ 2023-12-02  3:40   ` Jeff Law
  2023-12-02  5:47     ` Sam James
  0 siblings, 1 reply; 14+ messages in thread
From: Jeff Law @ 2023-12-02  3:40 UTC (permalink / raw)
  To: Sam James, 钟居哲; +Cc: thomas, fweimer, gcc-patches



On 12/1/23 18:13, Sam James wrote:
> 
> 钟居哲 <juzhe.zhong@rivai.ai> writes:
> 
>> Hi, This patch cause error on building newlib/glibc/musl on RISC-V port:
>>
>> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40:
>> error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
>>      8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
>>        |                                        ^~~~
>>        |                                        |
>>        |                                        const char *
> 
> This looks like an issue in newlib. We expect broken code to be broken
> by the recent changes. Can you investigate it on the newlib side?
A ton of stuff in newlib/libgloss is broken due to the compiler changes. 
  But that's not a big surprise -- much of the newlib/libgloss code is 
c89 and clearly wrong for c99 and newer.

Jeff

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-02  3:40   ` Jeff Law
@ 2023-12-02  5:47     ` Sam James
  2023-12-02 15:19       ` Jeff Law
  0 siblings, 1 reply; 14+ messages in thread
From: Sam James @ 2023-12-02  5:47 UTC (permalink / raw)
  To: Jeff Law
  Cc: Sam James, 钟居哲, thomas, fweimer, gcc-patches


Jeff Law <jeffreyalaw@gmail.com> writes:

> On 12/1/23 18:13, Sam James wrote:
>> 钟居哲 <juzhe.zhong@rivai.ai> writes:
>> 
>>> Hi, This patch cause error on building newlib/glibc/musl on RISC-V port:
>>>
>>> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40:
>>> error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
>>>      8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
>>>        |                                        ^~~~
>>>        |                                        |
>>>        |                                        const char *
>> This looks like an issue in newlib. We expect broken code to be
>> broken
>> by the recent changes. Can you investigate it on the newlib side?
> A ton of stuff in newlib/libgloss is broken due to the compiler
> changes.   But that's not a big surprise -- much of the
> newlib/libgloss code is c89 and clearly wrong for c99 and newer.

Yeah, it's probably a reasonable candidate for -fpermissive to start
with until it's cleaned up.

(Also, sorry, I didn't mean my comment to appear glib. I just meant to
say "yes, this looks expected".)

>
> Jeff

thanks,
sam

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-02  5:47     ` Sam James
@ 2023-12-02 15:19       ` Jeff Law
  2023-12-04  7:45         ` Kito Cheng
  0 siblings, 1 reply; 14+ messages in thread
From: Jeff Law @ 2023-12-02 15:19 UTC (permalink / raw)
  To: Sam James; +Cc: 钟居哲, thomas, fweimer, gcc-patches



On 12/1/23 22:47, Sam James wrote:
> 
> Jeff Law <jeffreyalaw@gmail.com> writes:
> 
>> On 12/1/23 18:13, Sam James wrote:
>>> 钟居哲 <juzhe.zhong@rivai.ai> writes:
>>>
>>>> Hi, This patch cause error on building newlib/glibc/musl on RISC-V port:
>>>>
>>>> /work/home/jzzhong/work/toolchain/riscv/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/../../newlib/libgloss/riscv/sys_access.c:8:40:
>>>> error: passing argument 3 of 'syscall_errno' makes integer from pointer without a cast [-Wint-conversion]
>>>>       8 |   return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
>>>>         |                                        ^~~~
>>>>         |                                        |
>>>>         |                                        const char *
>>> This looks like an issue in newlib. We expect broken code to be
>>> broken
>>> by the recent changes. Can you investigate it on the newlib side?
>> A ton of stuff in newlib/libgloss is broken due to the compiler
>> changes.   But that's not a big surprise -- much of the
>> newlib/libgloss code is c89 and clearly wrong for c99 and newer.
> 
> Yeah, it's probably a reasonable candidate for -fpermissive to start
> with until it's cleaned up.
Perhaps.  Particularly if it can be confined to libgloss as that's where 
the bulk of the problems are.   It'd be even better if we could 
constrain it per-port, but I suspect putting all that in place would be 
more work than just fixing this stuff.



> 
> (Also, sorry, I didn't mean my comment to appear glib. I just meant to
> say "yes, this looks expected".)
No worries, I didn't take it that way at all.  I fully agree this looks 
expected and while annoying it's not a big deal IMHO.  We fix and move on.

jeff

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-02 15:19       ` Jeff Law
@ 2023-12-04  7:45         ` Kito Cheng
  2023-12-05  0:25           ` Kito Cheng
  0 siblings, 1 reply; 14+ messages in thread
From: Kito Cheng @ 2023-12-04  7:45 UTC (permalink / raw)
  To: Jeff Law
  Cc: Sam James, 钟居哲, thomas, fweimer, gcc-patches

RISC-V newlib patch send, one for libgloss and another one for libm,
the libm issue is because we don't have right long double support,
however newlib has supported that few months ago, and porting effort
is minor, so I just port that to fix the issue :)

https://sourceware.org/pipermail/newlib/2023/020725.html
https://sourceware.org/pipermail/newlib/2023/020726.html

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-04  7:45         ` Kito Cheng
@ 2023-12-05  0:25           ` Kito Cheng
  0 siblings, 0 replies; 14+ messages in thread
From: Kito Cheng @ 2023-12-05  0:25 UTC (permalink / raw)
  To: Jeff Law
  Cc: Sam James, 钟居哲, thomas, fweimer, gcc-patches

both patches are landed, newlib trunk should be able to build with gcc
trunk now.

On Mon, Dec 4, 2023 at 3:45 PM Kito Cheng <kito.cheng@gmail.com> wrote:
>
> RISC-V newlib patch send, one for libgloss and another one for libm,
> the libm issue is because we don't have right long double support,
> however newlib has supported that few months ago, and porting effort
> is minor, so I just port that to fix the issue :)
>
> https://sourceware.org/pipermail/newlib/2023/020725.html
> https://sourceware.org/pipermail/newlib/2023/020726.html

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-12-01 11:29   ` Thomas Schwinge
@ 2023-12-01 11:36     ` Florian Weimer
  0 siblings, 0 replies; 14+ messages in thread
From: Florian Weimer @ 2023-12-01 11:36 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches

* Thomas Schwinge:

> I'm not proposing a patch as I don't know whether you'd like to just
> silence the diagnostic, fix (?) the test case, and/or add another
> 'dg-error'-checking test case?  (I've not yet looked at the history of
> the test case.)

Jakub just posted a patch:

  [PATCH] testsuite: Tweak some further tests for modern C changes
  <https://inbox.sourceware.org/gcc-patches/ZWnDFz+FcrkpsHzE@tucnak/>

Thanks,
Florian


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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-11-13 13:10 ` [PATCH 2/6] c: Turn int-conversion warnings into permerrors Florian Weimer
  2023-11-13 19:24   ` Jeff Law
@ 2023-12-01 11:29   ` Thomas Schwinge
  2023-12-01 11:36     ` Florian Weimer
  1 sibling, 1 reply; 14+ messages in thread
From: Thomas Schwinge @ 2023-12-01 11:29 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-patches

Hi Florian!

On 2023-11-13T14:10:34+0100, Florian Weimer <fweimer@redhat.com> wrote:
> --- a/gcc/c/c-typeck.cc
> +++ b/gcc/c/c-typeck.cc

> @@ -7616,27 +7639,28 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,

>         case ic_assign:
> -         pedwarn (location, OPT_Wint_conversion,
> -                  "assignment to %qT from %qT makes pointer from integer "
> -                  "without a cast", type, rhstype);
> +         pedpermerror (location, OPT_Wint_conversion,
> +                       "assignment to %qT from %qT makes pointer from "
> +                       "integer without a cast", type, rhstype);
>           break;

In addition to the many ones that you've fixed, there's one more:

    [-PASS:-]{+FAIL:+} gcc.dg/graphite/pr83126.c (test for excess errors)

    [...]/testsuite/gcc.dg/graphite/pr83126.c: In function 'ew':
    [...]/testsuite/gcc.dg/graphite/pr83126.c:15:10: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

Presumably your testing didn't have Graphite enabled due to missing
host libisl?  However, you should be able to reproduce without that:

    $ build-gcc/gcc/xgcc -Bbuild-gcc/gcc/ source-gcc/gcc/testsuite/gcc.dg/graphite/pr83126.c
    source-gcc/gcc/testsuite/gcc.dg/graphite/pr83126.c: In function ‘ew’:
    source-gcc/gcc/testsuite/gcc.dg/graphite/pr83126.c:15:10: error: assignment to ‘int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
       15 |       fd = *fd;
          |          ^

I'm not proposing a patch as I don't know whether you'd like to just
silence the diagnostic, fix (?) the test case, and/or add another
'dg-error'-checking test case?  (I've not yet looked at the history of
the test case.)


Grüße
 Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

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

* Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-11-13 13:10 ` [PATCH 2/6] c: Turn int-conversion warnings into permerrors Florian Weimer
@ 2023-11-13 19:24   ` Jeff Law
  2023-12-01 11:29   ` Thomas Schwinge
  1 sibling, 0 replies; 14+ messages in thread
From: Jeff Law @ 2023-11-13 19:24 UTC (permalink / raw)
  To: Florian Weimer, gcc-patches



On 11/13/23 06:10, Florian Weimer wrote:
> gcc/
> 
> 	* doc/invoke.texi (Warning Options): Document changes.
> 
> gcc/c/
> 
> 	* c-typeck.cc (build_conditional_expr): Use pedpermerror for
> 	pointer/integer type mismatches, based on -Wint-conversion.
> 	(pedwarn_pedpermerror_init, permerror_init): New function.
> 	(pedwarn_init): Call pedwarn_pedpermerror_init.
> 	(convert_for_assignment): Use pedpermerror and
> 	pedpermerror_init for -Wint-conversion	warnings.
> 
> gcc/testsuite/
> 
> 	* c-c++-common/pr77624-1.c (foo, bar): Expect
> 	error instead of warning.
> 	* gcc.dg/Wint-conversion-2.c: Compile with -fpermissive due
> 	to expected int-conversion warning.
> 	* gcc.dg/Wint-conversion-3.c: Likewise.
> 	* gcc.dg/Wint-conversion-4.c: New test.  Based on
> 	gcc.dg/Wint-conversion-3.c.  Expect int-conversion errors.
> 	* gcc.dg/assign-warn-1.c: Compile with -fpermissive.
> 	* gcc.dg/assign-warn-4.c: New file.  Extracted from
> 	assign-warn1.c.  Expect int-cnversion errors.
> 	* gcc.dg/diagnostic-types-1.c: compile with -fpermissive.
> 	* gcc.dg/diagnostic-types-2.c: New file.  Extracted from
> 	gcc.dg/diagnostic-types-1.c.  Expect some errors instead of
> 	warnings.
> 	* gcc.dg/gomp/pr35738.c: Compile with -fpermissive due to
> 	expected int-conversion error.
> 	* gcc.dg/gomp/pr35738-2.c: New test.  Based on
> 	gcc.dg/gomp/pr35738.c.  Expect int-converison errors.
> 	* gcc.dg/init-excess-3.c: Expect int-converison errors.
> 	* gcc.dg/overflow-warn-1.c: Likewise.
> 	* gcc.dg/overflow-warn-3.c: Likewise.
> 	* gcc.dg/param-type-mismatch.c: Compile with -fpermissive.
> 	* gcc.dg/param-type-mismatch-2.c: New test.  Copied from
> 	gcc.dg/param-type-mismatch.c.  Expect errors.
> 	* gcc.dg/pr61162-2.c: Compile with -fpermissive.
> 	* gcc.dg/pr61162-3.c: New test. Extracted from
> 	gcc.dg/pr61162-2.c.  Expect int-conversion errors.
> 	* gcc.dg/spec-barrier-3.c: Use -fpermissive due to expected
> 	int-conversion error.
> 	* gcc.dg/spec-barrier-3a.c: New test.  Based on
> 	gcc.dg/spec-barrier-3.c.  Expect int-conversion errors.
> 	* gcc.target/aarch64/acle/memtag_2.c: Use -fpermissive due to expected
> 	int-conversion error.
> 	* gcc.target/aarch64/acle/memtag_2a.c: New test.  Copied from
> 	gcc.target/aarch64/acle/memtag_2.c.  Expect error.
> 	* gcc.target/aarch64/sve/acle/general-c/load_3.c (f1): Expect
> 	error.
> 	* gcc.target/aarch64/sve/acle/general-c/store_2.c (f1): Likewise.
> 	* gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
> 	(f1): Likewise.
> 	* gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c
> 	(f1): Likewise.
> 	* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
> 	(f1): Likewise.
> 	* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
> 	(f1): Likewise.
OK
jeff

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

* [PATCH 2/6] c: Turn int-conversion warnings into permerrors
  2023-11-13 13:09 [PATCH 0/6] Turn some C warnings into errors by default Florian Weimer
@ 2023-11-13 13:10 ` Florian Weimer
  2023-11-13 19:24   ` Jeff Law
  2023-12-01 11:29   ` Thomas Schwinge
  0 siblings, 2 replies; 14+ messages in thread
From: Florian Weimer @ 2023-11-13 13:10 UTC (permalink / raw)
  To: gcc-patches

gcc/

	* doc/invoke.texi (Warning Options): Document changes.

gcc/c/

	* c-typeck.cc (build_conditional_expr): Use pedpermerror for
	pointer/integer type mismatches, based on -Wint-conversion.
	(pedwarn_pedpermerror_init, permerror_init): New function.
	(pedwarn_init): Call pedwarn_pedpermerror_init.
	(convert_for_assignment): Use pedpermerror and
	pedpermerror_init for -Wint-conversion	warnings.

gcc/testsuite/

	* c-c++-common/pr77624-1.c (foo, bar): Expect
	error instead of warning.
	* gcc.dg/Wint-conversion-2.c: Compile with -fpermissive due
	to expected int-conversion warning.
	* gcc.dg/Wint-conversion-3.c: Likewise.
	* gcc.dg/Wint-conversion-4.c: New test.  Based on
	gcc.dg/Wint-conversion-3.c.  Expect int-conversion errors.
	* gcc.dg/assign-warn-1.c: Compile with -fpermissive.
	* gcc.dg/assign-warn-4.c: New file.  Extracted from
	assign-warn1.c.  Expect int-cnversion errors.
	* gcc.dg/diagnostic-types-1.c: compile with -fpermissive.
	* gcc.dg/diagnostic-types-2.c: New file.  Extracted from
	gcc.dg/diagnostic-types-1.c.  Expect some errors instead of
	warnings.
	* gcc.dg/gomp/pr35738.c: Compile with -fpermissive due to
	expected int-conversion error.
	* gcc.dg/gomp/pr35738-2.c: New test.  Based on
	gcc.dg/gomp/pr35738.c.  Expect int-converison errors.
	* gcc.dg/init-excess-3.c: Expect int-converison errors.
	* gcc.dg/overflow-warn-1.c: Likewise.
	* gcc.dg/overflow-warn-3.c: Likewise.
	* gcc.dg/param-type-mismatch.c: Compile with -fpermissive.
	* gcc.dg/param-type-mismatch-2.c: New test.  Copied from
	gcc.dg/param-type-mismatch.c.  Expect errors.
	* gcc.dg/pr61162-2.c: Compile with -fpermissive.
	* gcc.dg/pr61162-3.c: New test. Extracted from
	gcc.dg/pr61162-2.c.  Expect int-conversion errors.
	* gcc.dg/spec-barrier-3.c: Use -fpermissive due to expected
	int-conversion error.
	* gcc.dg/spec-barrier-3a.c: New test.  Based on
	gcc.dg/spec-barrier-3.c.  Expect int-conversion errors.
	* gcc.target/aarch64/acle/memtag_2.c: Use -fpermissive due to expected
	int-conversion error.
	* gcc.target/aarch64/acle/memtag_2a.c: New test.  Copied from
	gcc.target/aarch64/acle/memtag_2.c.  Expect error.
	* gcc.target/aarch64/sve/acle/general-c/load_3.c (f1): Expect
	error.
	* gcc.target/aarch64/sve/acle/general-c/store_2.c (f1): Likewise.
	* gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
	(f1): Likewise.
	* gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c
	(f1): Likewise.
	* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
	(f1): Likewise.
	* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
	(f1): Likewise.
---
 gcc/c/c-typeck.cc                             |  98 +++++----
 gcc/doc/invoke.texi                           |   6 +
 gcc/testsuite/c-c++-common/pr77624-1.c        |   4 +-
 gcc/testsuite/gcc.dg/Wint-conversion-2.c      |   2 +-
 gcc/testsuite/gcc.dg/Wint-conversion-3.c      |   2 +-
 gcc/testsuite/gcc.dg/Wint-conversion-4.c      |  14 ++
 gcc/testsuite/gcc.dg/assign-warn-1.c          |   2 +-
 gcc/testsuite/gcc.dg/assign-warn-4.c          |  21 ++
 gcc/testsuite/gcc.dg/diagnostic-types-1.c     |   2 +-
 gcc/testsuite/gcc.dg/diagnostic-types-2.c     |  24 +++
 gcc/testsuite/gcc.dg/gomp/pr35738-2.c         |  18 ++
 gcc/testsuite/gcc.dg/gomp/pr35738.c           |   2 +-
 gcc/testsuite/gcc.dg/init-excess-3.c          |   4 +-
 gcc/testsuite/gcc.dg/overflow-warn-1.c        |   4 +-
 gcc/testsuite/gcc.dg/overflow-warn-3.c        |   4 +-
 gcc/testsuite/gcc.dg/param-type-mismatch-2.c  | 187 ++++++++++++++++++
 gcc/testsuite/gcc.dg/param-type-mismatch.c    |   2 +-
 gcc/testsuite/gcc.dg/pr61162-2.c              |   2 +-
 gcc/testsuite/gcc.dg/pr61162-3.c              |  13 ++
 gcc/testsuite/gcc.dg/spec-barrier-3.c         |   2 +-
 gcc/testsuite/gcc.dg/spec-barrier-3a.c        |  13 ++
 .../gcc.target/aarch64/acle/memtag_2.c        |   4 +-
 .../gcc.target/aarch64/acle/memtag_2a.c       |  71 +++++++
 .../aarch64/sve/acle/general-c/load_3.c       |   2 +-
 .../aarch64/sve/acle/general-c/store_2.c      |   2 +-
 .../acle/general-c/store_scatter_index_1.c    |   2 +-
 .../store_scatter_index_restricted_1.c        |   2 +-
 .../acle/general-c/store_scatter_offset_2.c   |   2 +-
 .../store_scatter_offset_restricted_1.c       |   2 +-
 29 files changed, 452 insertions(+), 61 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/Wint-conversion-4.c
 create mode 100644 gcc/testsuite/gcc.dg/assign-warn-4.c
 create mode 100644 gcc/testsuite/gcc.dg/diagnostic-types-2.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/pr35738-2.c
 create mode 100644 gcc/testsuite/gcc.dg/param-type-mismatch-2.c
 create mode 100644 gcc/testsuite/gcc.dg/pr61162-3.c
 create mode 100644 gcc/testsuite/gcc.dg/spec-barrier-3a.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/acle/memtag_2a.c

diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 366ca88c633..9d7bdbb4523 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -5436,8 +5436,9 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
 	   && (code2 == INTEGER_TYPE || code2 == BITINT_TYPE))
     {
       if (!null_pointer_constant_p (orig_op2))
-	pedwarn (colon_loc, OPT_Wint_conversion,
-		 "pointer/integer type mismatch in conditional expression");
+	pedpermerror (colon_loc, OPT_Wint_conversion,
+		      "pointer/integer type mismatch "
+		      "in conditional expression");
       else
 	{
 	  op2 = null_pointer_node;
@@ -5448,8 +5449,9 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
 	   && (code1 == INTEGER_TYPE || code1 == BITINT_TYPE))
     {
       if (!null_pointer_constant_p (orig_op1))
-	pedwarn (colon_loc, OPT_Wint_conversion,
-		 "pointer/integer type mismatch in conditional expression");
+	pedpermerror (colon_loc, OPT_Wint_conversion,
+		      "pointer/integer type mismatch "
+		      "in conditional expression");
       else
 	{
 	  op1 = null_pointer_node;
@@ -6545,28 +6547,49 @@ error_init (location_t loc, const char *gmsgid, ...)
     inform (loc, "(near initialization for %qs)", ofwhat);
 }
 
-/* Issue a pedantic warning for a bad initializer component.  OPT is
-   the option OPT_* (from options.h) controlling this warning or 0 if
-   it is unconditionally given.  GMSGID identifies the message.  The
-   component name is taken from the spelling stack.  */
+/* Used to implement pedwarn_init and permerror_init.  */
 
 static void ATTRIBUTE_GCC_DIAG (3,0)
-pedwarn_init (location_t loc, int opt, const char *gmsgid, ...)
+pedwarn_pedpermerror_init (location_t loc, int opt, const char *gmsgid,
+			   va_list *ap, diagnostic_t kind)
 {
   /* Use the location where a macro was expanded rather than where
      it was defined to make sure macros defined in system headers
      but used incorrectly elsewhere are diagnosed.  */
   location_t exploc = expansion_point_location_if_in_system_header (loc);
   auto_diagnostic_group d;
-  va_list ap;
-  va_start (ap, gmsgid);
-  bool warned = emit_diagnostic_valist (DK_PEDWARN, exploc, opt, gmsgid, &ap);
-  va_end (ap);
+  bool warned = emit_diagnostic_valist (kind, exploc, opt, gmsgid, ap);
   char *ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
   if (*ofwhat && warned)
     inform (exploc, "(near initialization for %qs)", ofwhat);
 }
 
+/* Issue a pedantic warning for a bad initializer component.  OPT is
+   the option OPT_* (from options.h) controlling this warning or 0 if
+   it is unconditionally given.  GMSGID identifies the message.  The
+   component name is taken from the spelling stack.  */
+
+static void ATTRIBUTE_GCC_DIAG (3,0)
+pedwarn_init (location_t loc, int opt, const char *gmsgid, ...)
+{
+  va_list ap;
+  va_start (ap, gmsgid);
+  pedwarn_pedpermerror_init (loc, opt, gmsgid, &ap, DK_PEDWARN);
+  va_end (ap);
+}
+
+/* Like pedwarn_init, but issue a permerror.  */
+
+static void ATTRIBUTE_GCC_DIAG (3,0)
+pedpermerror_init (location_t loc, int opt, const char *gmsgid, ...)
+{
+  va_list ap;
+  va_start (ap, gmsgid);
+  pedwarn_pedpermerror_init (loc, opt, gmsgid, &ap,
+			     flag_pedantic_errors ? DK_PEDWARN : DK_PERMERROR);
+  va_end (ap);
+}
+
 /* Issue a warning for a bad initializer component.
 
    OPT is the OPT_W* value corresponding to the warning option that
@@ -7616,27 +7639,28 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
 	      auto_diagnostic_group d;
 	      range_label_for_type_mismatch rhs_label (rhstype, type);
 	      gcc_rich_location richloc (expr_loc, &rhs_label);
-	      if (pedwarn (&richloc, OPT_Wint_conversion,
-			   "passing argument %d of %qE makes pointer from "
-			   "integer without a cast", parmnum, rname))
+	      if (pedpermerror (&richloc, OPT_Wint_conversion,
+				"passing argument %d of %qE makes pointer "
+				"from integer without a cast", parmnum, rname))
 		inform_for_arg (fundecl, expr_loc, parmnum, type, rhstype);
 	    }
 	    break;
 	  case ic_assign:
-	    pedwarn (location, OPT_Wint_conversion,
-		     "assignment to %qT from %qT makes pointer from integer "
-		     "without a cast", type, rhstype);
+	    pedpermerror (location, OPT_Wint_conversion,
+			  "assignment to %qT from %qT makes pointer from "
+			  "integer without a cast", type, rhstype);
 	    break;
 	  case ic_init:
 	  case ic_init_const:
-	    pedwarn_init (location, OPT_Wint_conversion,
-			  "initialization of %qT from %qT makes pointer from "
-			  "integer without a cast", type, rhstype);
+	    pedpermerror_init (location, OPT_Wint_conversion,
+			       "initialization of %qT from %qT makes pointer "
+			       "from integer without a cast", type, rhstype);
 	    break;
 	  case ic_return:
-	    pedwarn (location, OPT_Wint_conversion, "returning %qT from a "
-		     "function with return type %qT makes pointer from "
-		     "integer without a cast", rhstype, type);
+	    pedpermerror_init (location, OPT_Wint_conversion,
+			       "returning %qT from a function with return type "
+			       "%qT makes pointer from integer without a cast",
+			       rhstype, type);
 	    break;
 	  default:
 	    gcc_unreachable ();
@@ -7654,27 +7678,27 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
 	    auto_diagnostic_group d;
 	    range_label_for_type_mismatch rhs_label (rhstype, type);
 	    gcc_rich_location richloc (expr_loc, &rhs_label);
-	    if (pedwarn (&richloc, OPT_Wint_conversion,
-			 "passing argument %d of %qE makes integer from "
-			 "pointer without a cast", parmnum, rname))
+	    if (pedpermerror (&richloc, OPT_Wint_conversion,
+			      "passing argument %d of %qE makes integer from "
+			      "pointer without a cast", parmnum, rname))
 	      inform_for_arg (fundecl, expr_loc, parmnum, type, rhstype);
 	  }
 	  break;
 	case ic_assign:
-	  pedwarn (location, OPT_Wint_conversion,
-		   "assignment to %qT from %qT makes integer from pointer "
-		   "without a cast", type, rhstype);
+	  pedpermerror (location, OPT_Wint_conversion,
+			"assignment to %qT from %qT makes integer from "
+			"pointer without a cast", type, rhstype);
 	  break;
 	case ic_init:
 	case ic_init_const:
-	  pedwarn_init (location, OPT_Wint_conversion,
-			"initialization of %qT from %qT makes integer from "
-			"pointer without a cast", type, rhstype);
+	  pedpermerror_init (location, OPT_Wint_conversion,
+			     "initialization of %qT from %qT makes integer "
+			     "from pointer without a cast", type, rhstype);
 	  break;
 	case ic_return:
-	  pedwarn (location, OPT_Wint_conversion, "returning %qT from a "
-		   "function with return type %qT makes integer from "
-		   "pointer without a cast", rhstype, type);
+	  pedpermerror (location, OPT_Wint_conversion, "returning %qT from a "
+			"function with return type %qT makes integer from "
+			"pointer without a cast", rhstype, type);
 	  break;
 	default:
 	  gcc_unreachable ();
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f1a5722675f..b9fafe0fd34 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -6179,6 +6179,7 @@ only by this flag, but it also downgrades some C and C++ diagnostics
 that have their own flag:
 
 @gccoptlist{
+-Wint-conversion @r{(C)}
 -Wnarrowing @r{(C++)}
 }
 
@@ -8545,6 +8546,11 @@ conversions.  This warning is about implicit conversions; for explicit
 conversions the warnings @option{-Wno-int-to-pointer-cast} and
 @option{-Wno-pointer-to-int-cast} may be used.
 
+By default, in C99 and later dialects of C, GCC treats this issue as an
+error.  The error can be downgraded to a warning using
+@option{-fpermissive} (along with certain other errors), or for this
+error alone, with @option{-Wno-error=int-conversion}.
+
 This warning is upgraded to an error by @option{-pedantic-errors}.
 
 @opindex Wzero-length-bounds
diff --git a/gcc/testsuite/c-c++-common/pr77624-1.c b/gcc/testsuite/c-c++-common/pr77624-1.c
index 3567e9b866f..e25469ee2c1 100644
--- a/gcc/testsuite/c-c++-common/pr77624-1.c
+++ b/gcc/testsuite/c-c++-common/pr77624-1.c
@@ -4,11 +4,11 @@
 int
 foo (int a)
 {
-  return __atomic_is_lock_free (2, a);		/* { dg-warning "pointer from integer" "" { target c } } */
+  return __atomic_is_lock_free (2, a);		/* { dg-error "pointer from integer" "" { target c } } */
 }						/* { dg-error "invalid conversion" "" { target c++ } .-1 } */
 
 int
 bar (int a)
 {
-  return __atomic_always_lock_free (2, a);	/* { dg-warning "pointer from integer" "" { target c } } */
+  return __atomic_always_lock_free (2, a);	/* { dg-error "pointer from integer" "" { target c } } */
 }						/* { dg-error "invalid conversion" "" { target c++ } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/Wint-conversion-2.c b/gcc/testsuite/gcc.dg/Wint-conversion-2.c
index bf590a7bcd7..101e792e5b6 100644
--- a/gcc/testsuite/gcc.dg/Wint-conversion-2.c
+++ b/gcc/testsuite/gcc.dg/Wint-conversion-2.c
@@ -1,7 +1,7 @@
 /* PR middle-end/86202 - ICE in get_range_info calling an invalid memcpy()
    declaration */
 /* { dg-do compile } */
-/* { dg-options "-Wint-conversion" } */
+/* { dg-options "-fpermissive -Wint-conversion" } */
 
 void *memcpy (void *, void *, __SIZE_TYPE__ *);   /* { dg-warning "conflicting types for built-in function .memcpy." } */
 void *a, *b;
diff --git a/gcc/testsuite/gcc.dg/Wint-conversion-3.c b/gcc/testsuite/gcc.dg/Wint-conversion-3.c
index 4e514769c01..4614c015db4 100644
--- a/gcc/testsuite/gcc.dg/Wint-conversion-3.c
+++ b/gcc/testsuite/gcc.dg/Wint-conversion-3.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "" } */
+/* { dg-options "-fpermissive" } */
 
 const char *
 f1 (int flag)
diff --git a/gcc/testsuite/gcc.dg/Wint-conversion-4.c b/gcc/testsuite/gcc.dg/Wint-conversion-4.c
new file mode 100644
index 00000000000..6ded61aed9c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wint-conversion-4.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+const char *
+f1 (int flag)
+{
+  return flag ? "" : 1; /* { dg-error "pointer/integer type mismatch in conditional expression \\\[-Wint-conversion\\\]" } */
+}
+
+const char *
+f2 (int flag)
+{
+  return flag ? 1 : ""; /* { dg-error "pointer/integer type mismatch in conditional expression \\\[-Wint-conversion\\\]" } */
+}
diff --git a/gcc/testsuite/gcc.dg/assign-warn-1.c b/gcc/testsuite/gcc.dg/assign-warn-1.c
index 365025724c4..c483276a913 100644
--- a/gcc/testsuite/gcc.dg/assign-warn-1.c
+++ b/gcc/testsuite/gcc.dg/assign-warn-1.c
@@ -1,7 +1,7 @@
 /* Test diagnostics for bad implicit type conversions.  */
 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
 /* { dg-do compile } */
-/* { dg-options "-pedantic -ftrack-macro-expansion=0" } */
+/* { dg-options "-pedantic -fpermissive -ftrack-macro-expansion=0" } */
 
 #define TESTARG(ID, TL, TR) void ID##F(TL); void ID##F2(TR x) { ID##F(x); } extern int dummy
 #define TESTARP(ID, TL, TR) struct { void (*x)(TL); } ID##Fp; void ID##F2(TR x) { ID##Fp.x(x); } extern int dummy
diff --git a/gcc/testsuite/gcc.dg/assign-warn-4.c b/gcc/testsuite/gcc.dg/assign-warn-4.c
new file mode 100644
index 00000000000..da834f7d29d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/assign-warn-4.c
@@ -0,0 +1,21 @@
+/* Test diagnostics for bad implicit type conversions.  Error variant.  */
+/* { dg-do compile } */
+/* { dg-options "-ftrack-macro-expansion=0" } */
+
+#define TESTARG(ID, TL, TR) void ID##F(TL); void ID##F2(TR x) { ID##F(x); } extern int dummy
+#define TESTARP(ID, TL, TR) struct { void (*x)(TL); } ID##Fp; void ID##F2(TR x) { ID##Fp.x(x); } extern int dummy
+#define TESTASS(ID, TL, TR) void ID##F(TR x) { TL y; y = x; } extern int dummy
+#define TESTINI(ID, TL, TR) void ID##F(TR x) { TL y = x; } extern int dummy
+#define TESTRET(ID, TL, TR) TR ID##V; TL ID##F(void) { return ID##V; } extern int dummy
+
+TESTARG(ciia, char *, int); /* { dg-error "passing argument 1 of 'ciiaF' makes pointer from integer without a cast" } */
+TESTARP(ciib, char *, int); /* { dg-error "passing argument 1 of 'ciibFp.x' makes pointer from integer without a cast" } */
+TESTASS(ciic, char *, int); /* { dg-error "assignment to 'char \\*' from 'int' makes pointer from integer without a cast" } */
+TESTINI(ciid, char *, int); /* { dg-error "initialization of 'char \\*' from 'int' makes pointer from integer without a cast" } */
+TESTRET(ciie, char *, int); /* { dg-error "returning 'int' from a function with return type 'char \\*' makes pointer from integer without a cast" } */
+
+TESTARG(iica, int, char *); /* { dg-error "passing argument 1 of 'iicaF' makes integer from pointer without a cast" } */
+TESTARP(iicb, int, char *); /* { dg-error "passing argument 1 of 'iicbFp.x' makes integer from pointer without a cast" } */
+TESTASS(iicc, int, char *); /* { dg-error "assignment to 'int' from 'char \\*' makes integer from pointer without a cast" } */
+TESTINI(iicd, int, char *); /* { dg-error "initialization of 'int' from 'char \\*' makes integer from pointer without a cast" } */
+TESTRET(iice, int, char *); /* { dg-error "returning 'char \\*' from a function with return type 'int' makes integer from pointer without a cast" } */
diff --git a/gcc/testsuite/gcc.dg/diagnostic-types-1.c b/gcc/testsuite/gcc.dg/diagnostic-types-1.c
index fc4b104df05..94b67c6ae8d 100644
--- a/gcc/testsuite/gcc.dg/diagnostic-types-1.c
+++ b/gcc/testsuite/gcc.dg/diagnostic-types-1.c
@@ -1,6 +1,6 @@
 /* PR c/81233 */
 /* { dg-do compile } */
-/* { dg-options "-Wc++-compat -Wpedantic" } */
+/* { dg-options "-fpermissive -Wc++-compat -Wpedantic" } */
 /* Test we're printing the types, like the good compiler we are.  */
 
 enum E1 { A } e;
diff --git a/gcc/testsuite/gcc.dg/diagnostic-types-2.c b/gcc/testsuite/gcc.dg/diagnostic-types-2.c
new file mode 100644
index 00000000000..e6d284d2c5f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/diagnostic-types-2.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-Wpedantic" } */
+/* Test we're printing the types, like the good compiler we are.  */
+
+extern void foo2 (int *); /* { dg-message "expected 'int \\*' but argument is of type 'int'" } */
+extern void foo3 (int); /* { dg-message "expected 'int' but argument is of type 'int \\*'" } */
+
+int *
+fn1 (int *p)
+{
+  p = 1; /* { dg-error "assignment to 'int \\*' from 'int' makes pointer from integer without a cast" } */
+  int *q = 1; /* { dg-error "initialization of 'int \\*' from 'int' makes pointer from integer without a cast" } */
+  foo2 (1); /* { dg-error "passing argument 1 of 'foo2' makes pointer from integer without a cast" } */
+  return 1; /* { dg-error "returning 'int' from a function with return type 'int \\*' makes pointer from integer without a cast" } */
+}
+
+int
+fn2 (int i, int *p)
+{
+  i = p; /* { dg-error "assignment to 'int' from 'int \\*' makes integer from pointer without a cast" } */
+  int j = p; /* { dg-error "initialization of 'int' from 'int \\*' makes integer from pointer without a cast" } */
+  foo3 (p); /* { dg-error "passing argument 1 of 'foo3' makes integer from pointer without a cast" } */
+  return p; /* { dg-error "returning 'int \\*' from a function with return type 'int' makes integer from pointer without a cast" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr35738-2.c b/gcc/testsuite/gcc.dg/gomp/pr35738-2.c
new file mode 100644
index 00000000000..846afe7e778
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr35738-2.c
@@ -0,0 +1,18 @@
+/* PR c/35738 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void foo (void);
+
+void
+bar (void *p)
+{
+  int i = 0;
+  char q[10];
+#pragma omp atomic
+  i += q;		/* { dg-error "makes integer from pointer without a cast" } */
+#pragma omp atomic
+  i += foo;		/* { dg-error "makes integer from pointer without a cast" } */
+#pragma omp atomic
+  i += p;		/* { dg-error "makes integer from pointer without a cast" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr35738.c b/gcc/testsuite/gcc.dg/gomp/pr35738.c
index 0b3866eae3b..954cfa43ece 100644
--- a/gcc/testsuite/gcc.dg/gomp/pr35738.c
+++ b/gcc/testsuite/gcc.dg/gomp/pr35738.c
@@ -1,6 +1,6 @@
 /* PR c/35738 */
 /* { dg-do compile } */
-/* { dg-options "-fopenmp" } */
+/* { dg-options "-fpermissive -fopenmp" } */
 
 void foo (void);
 
diff --git a/gcc/testsuite/gcc.dg/init-excess-3.c b/gcc/testsuite/gcc.dg/init-excess-3.c
index c03a98487b4..6ea7858a1c9 100644
--- a/gcc/testsuite/gcc.dg/init-excess-3.c
+++ b/gcc/testsuite/gcc.dg/init-excess-3.c
@@ -7,9 +7,9 @@
 char s0[] = {"abc",1}; /* { dg-error "'char..' initializer|near init" } */
 char s1[] = {"abc","a"}; /* { dg-error "'char..' initializer|near init" } */
 char s2[] = {1,"abc"}; /* { dg-error "'char..' initializer|near init|computable at load time" } */
-/* { dg-warning "integer from pointer without a cast" "" { target *-*-* } .-1 } */
+/* { dg-error "integer from pointer without a cast" "" { target *-*-* } .-1 } */
 
 char s3[5] = {"abc",1}; /* { dg-error "'char.5.' initializer|near init" } */
 char s4[5] = {"abc","a"}; /* { dg-error "'char.5.' initializer|near init" } */
 char s5[5] = {1,"abc"}; /* { dg-error "'char.5.' initializer|near init|computable at load time" } */
-/* { dg-warning "integer from pointer without a cast" "" { target *-*-* } .-1 } */
+/* { dg-error "integer from pointer without a cast" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/overflow-warn-1.c b/gcc/testsuite/gcc.dg/overflow-warn-1.c
index a9d9fbae148..90eb43b35e2 100644
--- a/gcc/testsuite/gcc.dg/overflow-warn-1.c
+++ b/gcc/testsuite/gcc.dg/overflow-warn-1.c
@@ -47,10 +47,10 @@ static int sc = INT_MAX + 1; /* { dg-warning "25:integer overflow in expression"
    constants.  The third has the overflow in an unevaluated
    subexpression, so is a null pointer constant.  */
 void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
-/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-1 } */
+/* { dg-error "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-1 } */
 void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
 /* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */
-/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
+/* { dg-error "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
 void *r = (1 ? 0 : INT_MAX+1);
 
 void
diff --git a/gcc/testsuite/gcc.dg/overflow-warn-3.c b/gcc/testsuite/gcc.dg/overflow-warn-3.c
index f64047795c7..a2ead836964 100644
--- a/gcc/testsuite/gcc.dg/overflow-warn-3.c
+++ b/gcc/testsuite/gcc.dg/overflow-warn-3.c
@@ -53,10 +53,10 @@ static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" }
    subexpression, so is a null pointer constant.  */
 void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
 /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
-/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
+/* { dg-error "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
 void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
 /* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */
-/* { dg-warning "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
+/* { dg-error "initialization of 'void \\*' from 'int' makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */
 void *r = (1 ? 0 : INT_MAX+1);
 
 void
diff --git a/gcc/testsuite/gcc.dg/param-type-mismatch-2.c b/gcc/testsuite/gcc.dg/param-type-mismatch-2.c
new file mode 100644
index 00000000000..91d998437d1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/param-type-mismatch-2.c
@@ -0,0 +1,187 @@
+/* { dg-options "-fdiagnostics-show-caret -Wpointer-sign" }  */
+
+/* A collection of calls where argument 2 is of the wrong type.
+   Like param-type-mismatch.c, but expecting errors.  */
+
+/* decl, with argname.  */
+
+extern int callee_1 (int one, const char *two, float three); /* { dg-line callee_1 } */
+
+int test_1 (int first, int second, float third)
+{
+  return callee_1 (first, second, third); /* { dg-error "passing argument 2 of 'callee_1' makes pointer from integer without a cast" }  */
+  /* { dg-begin-multiline-output "" }
+   return callee_1 (first, second, third);
+                           ^~~~~~
+                           |
+                           int
+     { dg-end-multiline-output "" } */
+  /* { dg-message "expected 'const char \\*' but argument is of type 'int'" "" { target *-*-* } callee_1 } */
+  /* { dg-begin-multiline-output "" }
+ extern int callee_1 (int one, const char *two, float three);
+                               ~~~~~~~~~~~~^~~
+     { dg-end-multiline-output "" } */
+}
+
+/* decl, without argname.  */
+
+extern int callee_2 (int, const char *, float); /* { dg-line callee_2 } */
+
+int test_2 (int first, int second, float third)
+{
+  return callee_2 (first, second, third); /* { dg-error "passing argument 2 of 'callee_2' makes pointer from integer without a cast" } */
+  /* { dg-begin-multiline-output "" }
+   return callee_2 (first, second, third);
+                           ^~~~~~
+                           |
+                           int
+     { dg-end-multiline-output "" } */
+  /* { dg-message "expected 'const char \\*' but argument is of type 'int'" "" { target *-*-* } callee_2 } */
+  /* { dg-begin-multiline-output "" }
+ extern int callee_2 (int, const char *, float);
+                           ^~~~~~~~~~~~
+     { dg-end-multiline-output "" } */
+}
+
+/* defn, with argname.  */
+
+static int callee_3 (int one, const char *two, float three) /* { dg-line callee_3 } */
+{
+  return callee_2 (one, two, three);
+}
+
+int test_3 (int first, int second, float third)
+{
+  return callee_3 (first, second, third); // { dg-error "passing argument 2 of 'callee_3' makes pointer from integer without a cast" }
+  /* { dg-begin-multiline-output "" }
+   return callee_3 (first, second, third);
+                           ^~~~~~
+                           |
+                           int
+     { dg-end-multiline-output "" } */
+  /* { dg-message "expected 'const char \\*' but argument is of type 'int'" "" { target *-*-* } callee_3 } */
+  /* { dg-begin-multiline-output "" }
+ static int callee_3 (int one, const char *two, float three)
+                               ~~~~~~~~~~~~^~~
+     { dg-end-multiline-output "" } */
+}
+
+/* Trivial decl, with argname.  */
+
+extern int callee_4 (int one, float two, float three); /* { dg-line callee_4 } */
+
+int test_4 (int first, const char *second, float third)
+{
+  return callee_4 (first, second, third); /* { dg-error "incompatible type for argument 2 of 'callee_4'" }  */
+  /* { dg-begin-multiline-output "" }
+   return callee_4 (first, second, third);
+                           ^~~~~~
+                           |
+                           const char *
+     { dg-end-multiline-output "" } */
+  /* { dg-message "expected 'float' but argument is of type 'const char \\*'" "" { target *-*-* } callee_4 } */
+  /* { dg-begin-multiline-output "" }
+ extern int callee_4 (int one, float two, float three);
+                               ~~~~~~^~~
+     { dg-end-multiline-output "" } */
+}
+
+/* Trivial decl, without argname.  */
+
+extern int callee_5 (int, float, float); /* { dg-line callee_5 } */
+
+int test_5 (int first, const char *second, float third)
+{
+  return callee_5 (first, second, third); /* { dg-error "incompatible type for argument 2 of 'callee_5'" }  */
+  /* { dg-begin-multiline-output "" }
+   return callee_5 (first, second, third);
+                           ^~~~~~
+                           |
+                           const char *
+     { dg-end-multiline-output "" } */
+  /* { dg-message "expected 'float' but argument is of type 'const char \\*'" "" { target *-*-* } callee_5 } */
+  /* { dg-begin-multiline-output "" }
+ extern int callee_5 (int, float, float);
+                           ^~~~~
+     { dg-end-multiline-output "" } */
+}
+
+/* Callback with name.  */
+
+extern int callee_6 (int one, int (*two)(int, int), float three); /* { dg-line callee_6 } */
+
+int test_6 (int first, int second, float third)
+{
+  return callee_6 (first, second, third); /* { dg-error "passing argument 2 of 'callee_6' makes pointer from integer without a cast" } */
+  /* { dg-begin-multiline-output "" }
+   return callee_6 (first, second, third);
+                           ^~~~~~
+                           |
+                           int
+     { dg-end-multiline-output "" } */
+  /* { dg-message " expected 'int \\(\\*\\)\\(int,  int\\)' but argument is of type 'int'" "" { target *-*-* } callee_6 } */
+  /* { dg-begin-multiline-output "" }
+ extern int callee_6 (int one, int (*two)(int, int), float three);
+                               ~~~~~~^~~~~~~~~~~~~~
+     { dg-end-multiline-output "" } */
+}
+
+/* Callback without name.  */
+
+extern int callee_7 (int one, int (*)(int, int), float three); /* { dg-line callee_7 } */
+
+int test_7 (int first, int second, float third)
+{
+  return callee_7 (first, second, third); /* { dg-error "passing argument 2 of 'callee_7' makes pointer from integer without a cast" } */
+  /* { dg-begin-multiline-output "" }
+   return callee_7 (first, second, third);
+                           ^~~~~~
+                           |
+                           int
+     { dg-end-multiline-output "" } */
+  /* { dg-message " expected 'int \\(\\*\\)\\(int,  int\\)' but argument is of type 'int'" "" { target *-*-* } callee_7 } */
+  /* { dg-begin-multiline-output "" }
+ extern int callee_7 (int one, int (*)(int, int), float three);
+                               ^~~~~~~~~~~~~~~~~
+     { dg-end-multiline-output "" } */
+}
+
+/* -Wincompatible-pointer-types for a parameter.  */
+
+extern int callee_8 (int one, float *two, float (three)); /* { dg-line callee_8 } */
+
+int test_8 (int first, int *second, float third)
+{
+  return callee_8 (first, second, third); /* { dg-warning "passing argument 2 of 'callee_8' from incompatible pointer type" } */
+  /* { dg-begin-multiline-output "" }
+   return callee_8 (first, second, third);
+                           ^~~~~~
+                           |
+                           int *
+     { dg-end-multiline-output "" } */
+  /* { dg-message "expected 'float \\*' but argument is of type 'int \\*'" "" { target *-*-* } callee_8 } */
+  /* { dg-begin-multiline-output "" }
+ extern int callee_8 (int one, float *two, float (three));
+                               ~~~~~~~^~~
+     { dg-end-multiline-output "" } */
+}
+
+/* -Wpointer-sign for a parameter.  */
+
+extern int callee_9 (int one, int *two, float (three)); /* { dg-line callee_9 } */
+
+int test_9 (int first, unsigned int *second, float third)
+{
+  return callee_9 (first, second, third); /* { dg-warning "pointer targets in passing argument 2 of 'callee_9' differ in signedness" } */
+  /* { dg-begin-multiline-output "" }
+   return callee_9 (first, second, third);
+                           ^~~~~~
+                           |
+                           unsigned int *
+     { dg-end-multiline-output "" } */
+  /* { dg-message "expected 'int \\*' but argument is of type 'unsigned int \\*'" "" { target *-*-* } callee_9 } */
+  /* { dg-begin-multiline-output "" }
+ extern int callee_9 (int one, int *two, float (three));
+                               ~~~~~^~~
+     { dg-end-multiline-output "" } */
+}
diff --git a/gcc/testsuite/gcc.dg/param-type-mismatch.c b/gcc/testsuite/gcc.dg/param-type-mismatch.c
index 9e654a9e9c6..f6d68749cd8 100644
--- a/gcc/testsuite/gcc.dg/param-type-mismatch.c
+++ b/gcc/testsuite/gcc.dg/param-type-mismatch.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fdiagnostics-show-caret -Wpointer-sign" }  */
+/* { dg-options "-fpermissive -fdiagnostics-show-caret -Wpointer-sign" }  */
 
 /* A collection of calls where argument 2 is of the wrong type.  */
 
diff --git a/gcc/testsuite/gcc.dg/pr61162-2.c b/gcc/testsuite/gcc.dg/pr61162-2.c
index 4aa8493d1a3..a7d0b45a310 100644
--- a/gcc/testsuite/gcc.dg/pr61162-2.c
+++ b/gcc/testsuite/gcc.dg/pr61162-2.c
@@ -1,6 +1,6 @@
 /* PR c/61162 */
 /* { dg-do compile } */
-/* { dg-options "-Wc++-compat -Wpointer-sign -Wpedantic" } */
+/* { dg-options "-fpermissive -Wc++-compat -Wpointer-sign -Wpedantic" } */
 
 enum e { A };
 struct s { int a; };
diff --git a/gcc/testsuite/gcc.dg/pr61162-3.c b/gcc/testsuite/gcc.dg/pr61162-3.c
new file mode 100644
index 00000000000..c48625797d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr61162-3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+int
+fn4 (int *a)
+{
+  return a; /* { dg-error "10:returning 'int \\*' from a function with return type 'int' makes integer from pointer without a cast" } */
+}
+
+int *
+fn5 (int a)
+{
+  return a; /* { dg-error "10:returning 'int' from a function with return type 'int \\*' makes pointer from integer without a cast" } */
+}
diff --git a/gcc/testsuite/gcc.dg/spec-barrier-3.c b/gcc/testsuite/gcc.dg/spec-barrier-3.c
index 3ed4d39061a..0940a2105c6 100644
--- a/gcc/testsuite/gcc.dg/spec-barrier-3.c
+++ b/gcc/testsuite/gcc.dg/spec-barrier-3.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-Wpedantic" } */
+/* { dg-options "-fpermissive -Wpedantic" } */
 
 /* __builtin_speculation_safe_value returns a value with the same type
    as its first argument.  There should be a warning if that isn't
diff --git a/gcc/testsuite/gcc.dg/spec-barrier-3a.c b/gcc/testsuite/gcc.dg/spec-barrier-3a.c
new file mode 100644
index 00000000000..ee98ad0ca50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/spec-barrier-3a.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-Wpedantic" } */
+
+/* __builtin_speculation_safe_value returns a value with the same type
+   as its first argument.  There should be an error if that isn't
+   type-compatible with the use.  */
+int *
+f (int x)
+{
+  return __builtin_speculation_safe_value (x);  /* { dg-error "returning 'int' from a function with return type 'int \\*' makes pointer from integer without a cast" } */
+}
+
+/* { dg-prune-output "this target does not define a speculation barrier;" } */
diff --git a/gcc/testsuite/gcc.target/aarch64/acle/memtag_2.c b/gcc/testsuite/gcc.target/aarch64/acle/memtag_2.c
index fcab05b7abe..806e0750fd1 100644
--- a/gcc/testsuite/gcc.target/aarch64/acle/memtag_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/acle/memtag_2.c
@@ -2,7 +2,7 @@
 
 /* { dg-do compile } */
 /* { dg-require-effective-target lp64 } */
-/* { dg-options "-O3 -march=armv8.5-a+memtag" } */
+/* { dg-options "-fpermissive -O3 -march=armv8.5-a+memtag" } */
 
 #include "arm_acle.h"
 
@@ -67,4 +67,4 @@ test_memtag_error_argument (void)
   __arm_mte_ptrdiff(no_decl2, 0);	/* { dg-error {} } */
   __arm_mte_ptrdiff(0);			/* { dg-error {} } */
   __arm_mte_ptrdiff();			/* { dg-error {} } */
-}
\ No newline at end of file
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/acle/memtag_2a.c b/gcc/testsuite/gcc.target/aarch64/acle/memtag_2a.c
new file mode 100644
index 00000000000..16db40df663
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/acle/memtag_2a.c
@@ -0,0 +1,71 @@
+/* Test the MEMTAG intrinsic qualifier warnings and argument errors.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O3 -march=armv8.5-a+memtag" } */
+
+#include "arm_acle.h"
+
+void
+test_memtag_warning_return_qualifier (void)
+{
+  const char *c;
+  volatile char *v;
+  char *n;
+  int *i;
+  int64_t d;
+
+  v = __arm_mte_get_tag(c);		  /* { dg-warning {assignment} } */
+  n = __arm_mte_get_tag(c);		  /* { dg-warning {assignment} } */
+  i = __arm_mte_get_tag(c);		  /* { dg-warning {assignment} } */
+  c = __arm_mte_get_tag(v);		  /* { dg-warning {assignment} } */
+  n = __arm_mte_get_tag(v);		  /* { dg-warning {assignment} } */
+
+  i = __arm_mte_create_random_tag (c, 0); /* { dg-warning {assignment} } */
+  i = __arm_mte_increment_tag (c, 0);	  /* { dg-warning {assignment} } */
+
+  c = __arm_mte_get_tag(n);		  /* No warning.  */
+  d = __arm_mte_ptrdiff(c, i);		  /* No warning.  */
+}
+
+void
+test_memtag_warning_argument (void)
+{
+  const char *c;
+  __arm_mte_exclude_tag(0, 0);		/* No warning.  */
+  __arm_mte_create_random_tag (0, 0);	/* No warning.  */
+  __arm_mte_set_tag(0);			/* No warning.  */
+  __arm_mte_get_tag(0);			/* No warning.  */
+  __arm_mte_increment_tag (0, 15);	/* No warning.  */
+  __arm_mte_ptrdiff(c, 0);		/* No warning.  */
+  __arm_mte_ptrdiff(0, c);		/* No warning.  */
+}
+
+void
+test_memtag_error_argument (void)
+{
+  /* Produce errors properly for invalid arguments.  */
+  __arm_mte_exclude_tag(no_decl, 0);	/* { dg-error {} } */
+  __arm_mte_exclude_tag();		/* { dg-error {} } */
+  __arm_mte_ptrdiff(no_decl2, 0);	/* { dg-error {} } */
+  __arm_mte_ptrdiff(0);			/* { dg-error {} } */
+  __arm_mte_ptrdiff();			/* { dg-error {} } */
+
+  const char *c;
+  uint64_t i;
+  __arm_mte_exclude_tag(i, 0);		/* { dg-error {argument} } */
+  __arm_mte_create_random_tag (i, 0);	/* { dg-error {argument} } */
+  __arm_mte_set_tag(i);			/* { dg-error {argument} } */
+  __arm_mte_get_tag(i);			/* { dg-error {argument} } */
+  __arm_mte_increment_tag (i, 15);	/* { dg-error {argument} } */
+  __arm_mte_ptrdiff(c, i);		/* { dg-error {argument} } */
+  __arm_mte_ptrdiff(i, c);		/* { dg-error {argument} } */
+
+  __arm_mte_exclude_tag(1, 0);		/* { dg-error {argument} } */
+  __arm_mte_create_random_tag (1, 0);	/* { dg-error {argument} } */
+  __arm_mte_set_tag(1);			/* { dg-error {argument} } */
+  __arm_mte_get_tag(1);			/* { dg-error {argument} } */
+  __arm_mte_increment_tag (1, 15);	/* { dg-error {argument} } */
+  __arm_mte_ptrdiff(c, 1);		/* { dg-error {argument} } */
+  __arm_mte_ptrdiff(1, c);		/* { dg-error {argument} } */
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_3.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_3.c
index 770203f64c8..34166395ecc 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_3.c
@@ -13,6 +13,6 @@ f1 (svbool_t pg, signed char *s8_ptr, svint8_t s8)
   svld1_vnum (pg, s8_ptr, 0, 0); /* { dg-error {too many arguments to function 'svld1_vnum'} } */
   svld1_vnum (0, s8_ptr, 0); /* { dg-error {passing 'int' to argument 1 of 'svld1_vnum', which expects 'svbool_t'} } */
   svld1_vnum (pg, 0, 0); /* { dg-error {passing 'int' to argument 2 of 'svld1_vnum', which expects a pointer type} } */
-  svld1_vnum (pg, s8_ptr, s8_ptr); /* { dg-warning "passing argument 3 of 'svld1_vnum_s8' makes integer from pointer without a cast" } */
+  svld1_vnum (pg, s8_ptr, s8_ptr); /* { dg-error "passing argument 3 of 'svld1_vnum_s8' makes integer from pointer without a cast" } */
   svld1_vnum (pg, s8_ptr, s8); /* { dg-error {passing 'svint8_t' to argument 3 of 'svld1_vnum', which expects 'int64_t'} } */
 }
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_2.c
index c718b3ee04e..669f8844bc1 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_2.c
@@ -14,7 +14,7 @@ f1 (svbool_t pg, signed char *s8_ptr, void *void_ptr, struct s *s_ptr,
   svst1_vnum (0, s8_ptr, 0, s8); /* { dg-error {passing 'int' to argument 1 of 'svst1_vnum', which expects 'svbool_t'} } */
   svst1_vnum (pg, s8_ptr, pg, s8); /* { dg-error {passing 'svbool_t' to argument 3 of 'svst1_vnum', which expects 'int64_t'} } */
   svst1_vnum (pg, s8_ptr, s8, s8); /* { dg-error {passing 'svint8_t' to argument 3 of 'svst1_vnum', which expects 'int64_t'} } */
-  svst1_vnum (pg, s8_ptr, void_ptr, s8); /* { dg-warning "passing argument 3 of 'svst1_vnum_s8' makes integer from pointer without a cast" } */
+  svst1_vnum (pg, s8_ptr, void_ptr, s8); /* { dg-error "passing argument 3 of 'svst1_vnum_s8' makes integer from pointer without a cast" } */
   svst1_vnum (pg, void_ptr, 0, 0); /* { dg-error {passing 'int' to argument 4 of 'svst1_vnum', which expects an SVE vector type} } */
   svst1_vnum (pg, void_ptr, 0, pg); /* { dg-error {'svst1_vnum' has no form that takes 'svbool_t' arguments} } */
   svst1_vnum (pg, 0, 0, s8);
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
index 89528237522..29f4510c49b 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
@@ -26,7 +26,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr,
   svst1_scatter_index (pg, cf32_ptr, s32, f32); /* { dg-warning "passing argument 2 of 'svst1_scatter_s32index_f32' from incompatible pointer type" } */
   svst1_scatter_index (pg, s, s32, s32); /* { dg-error {passing 'struct s' to argument 2 of 'svst1_scatter_index', which expects a vector or pointer base address} } */
 
-  svst1_scatter_index (pg, u32, void_ptr, s32); /* { dg-warning "passing argument 3 of 'svst1_scatter_u32base_index_s32' makes integer from pointer without a cast" } */
+  svst1_scatter_index (pg, u32, void_ptr, s32); /* { dg-error "passing argument 3 of 'svst1_scatter_u32base_index_s32' makes integer from pointer without a cast" } */
   svst1_scatter_index (pg, u32, pg, s32); /* { dg-error {passing 'svbool_t' to argument 3 of 'svst1_scatter_index', which expects 'int64_t'} } */
   svst1_scatter_index (pg, u32, s32, s32); /* { dg-error {passing 'svint32_t' to argument 3 of 'svst1_scatter_index', which expects 'int64_t'} } */
 
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c
index 5e31362c412..ab718b5eeee 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c
@@ -28,7 +28,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr,
   svstnt1_scatter_index (pg, cf64_ptr, s64, f64); /* { dg-warning "passing argument 2 of 'svstnt1_scatter_s64index_f64' from incompatible pointer type" } */
   svstnt1_scatter_index (pg, s, s64, s64); /* { dg-error {passing 'struct s' to argument 2 of 'svstnt1_scatter_index', which expects a vector or pointer base address} } */
 
-  svstnt1_scatter_index (pg, u32, void_ptr, s32); /* { dg-warning "passing argument 3 of 'svstnt1_scatter_u32base_index_s32' makes integer from pointer without a cast" } */
+  svstnt1_scatter_index (pg, u32, void_ptr, s32); /* { dg-error "passing argument 3 of 'svstnt1_scatter_u32base_index_s32' makes integer from pointer without a cast" } */
   svstnt1_scatter_index (pg, u32, pg, s32); /* { dg-error {passing 'svbool_t' to argument 3 of 'svstnt1_scatter_index', which expects 'int64_t'} } */
   svstnt1_scatter_index (pg, u32, s32, s32); /* { dg-error {passing 'svint32_t' to argument 3 of 'svstnt1_scatter_index', which expects 'int64_t'} } */
 
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
index 4854818cae6..311b1744c91 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
@@ -26,7 +26,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr,
   svst1_scatter_offset (pg, cf32_ptr, s32, f32); /* { dg-warning "passing argument 2 of 'svst1_scatter_s32offset_f32' from incompatible pointer type" } */
   svst1_scatter_offset (pg, s, s32, s32); /* { dg-error {passing 'struct s' to argument 2 of 'svst1_scatter_offset', which expects a vector or pointer base address} } */
 
-  svst1_scatter_offset (pg, u32, void_ptr, s32); /* { dg-warning "passing argument 3 of 'svst1_scatter_u32base_offset_s32' makes integer from pointer without a cast" } */
+  svst1_scatter_offset (pg, u32, void_ptr, s32); /* { dg-error "passing argument 3 of 'svst1_scatter_u32base_offset_s32' makes integer from pointer without a cast" } */
   svst1_scatter_offset (pg, u32, pg, s32); /* { dg-error {passing 'svbool_t' to argument 3 of 'svst1_scatter_offset', which expects 'int64_t'} } */
   svst1_scatter_offset (pg, u32, s32, s32); /* { dg-error {passing 'svint32_t' to argument 3 of 'svst1_scatter_offset', which expects 'int64_t'} } */
 
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
index 100624b7b03..5b251127a47 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
@@ -28,7 +28,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr,
   svstnt1_scatter_offset (pg, cf32_ptr, u32, f32); /* { dg-warning "passing argument 2 of 'svstnt1_scatter_u32offset_f32' from incompatible pointer type" } */
   svstnt1_scatter_offset (pg, s, u32, s32); /* { dg-error {passing 'struct s' to argument 2 of 'svstnt1_scatter_offset', which expects a vector or pointer base address} } */
 
-  svstnt1_scatter_offset (pg, u32, void_ptr, s32); /* { dg-warning "passing argument 3 of 'svstnt1_scatter_u32base_offset_s32' makes integer from pointer without a cast" } */
+  svstnt1_scatter_offset (pg, u32, void_ptr, s32); /* { dg-error "passing argument 3 of 'svstnt1_scatter_u32base_offset_s32' makes integer from pointer without a cast" } */
   svstnt1_scatter_offset (pg, u32, pg, s32); /* { dg-error {passing 'svbool_t' to argument 3 of 'svstnt1_scatter_offset', which expects 'int64_t'} } */
   svstnt1_scatter_offset (pg, u32, s32, s32); /* { dg-error {passing 'svint32_t' to argument 3 of 'svstnt1_scatter_offset', which expects 'int64_t'} } */
 
-- 
2.41.0



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

end of thread, other threads:[~2023-12-05  0:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-02  0:33 [PATCH 2/6] c: Turn int-conversion warnings into permerrors 钟居哲
2023-12-02  1:10 ` Patrick O'Neill
2023-12-02  1:53   ` 钟居哲
2023-12-02  3:25     ` Patrick O'Neill
2023-12-02  1:13 ` Sam James
2023-12-02  3:40   ` Jeff Law
2023-12-02  5:47     ` Sam James
2023-12-02 15:19       ` Jeff Law
2023-12-04  7:45         ` Kito Cheng
2023-12-05  0:25           ` Kito Cheng
  -- strict thread matches above, loose matches on Subject: below --
2023-11-13 13:09 [PATCH 0/6] Turn some C warnings into errors by default Florian Weimer
2023-11-13 13:10 ` [PATCH 2/6] c: Turn int-conversion warnings into permerrors Florian Weimer
2023-11-13 19:24   ` Jeff Law
2023-12-01 11:29   ` Thomas Schwinge
2023-12-01 11:36     ` Florian Weimer

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 read-only IMAP folder(s) and NNTP newsgroup(s).