[PATCH v1 1/7] LoongArch Port: gcc

Xi Ruoyao xry111@mengyan1223.wang
Tue Nov 9 13:53:35 GMT 2021

On Mon, 2021-11-08 at 23:14 +0000, Joseph Myers wrote:

/* snip */

> Please make sure the back end builds cleanly with current GCC mainline.  
> This can be tested either with a native bootstrap, or by building a cross 
> compiler, using a native compiler of the same GCC mainline version for the 
> build and configuring using --enable-werror-always (that configure option 
> has the effect of enabling -Werror in the same way that later bootstrap 
> stages in a native bootstrap do).

gcc trunk does not build with glibc-2.34+ and --enable-werror-always :(

gcc -c -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wold-style-definition -Wmissing-format-attribute -Wno-overlength-strings -pedan
tic -Wno-long-long -Werror  -DHAVE_CONFIG_H -I. -I../../../fixincludes -I../incl
ude -I../../../fixincludes/../include ../../../fixincludes/fixincl.c
../../../fixincludes/fixincl.c: In function ‘process’:
../../../fixincludes/fixincl.c:1356:7: error: argument 1 is null but the corresp
onding size argument 2 value is 4096 [-Werror=nonnull]
 1356 |       fprintf (stderr, "Cannot access %s from %s\n\terror %d (%s)\n",
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1357 |                pz_curr_file, getcwd ((char *) NULL, MAXPATHLEN),
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1358 |                erno, xstrerror (erno));
      |                ~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../fixincludes/system.h:192,
                 from ../../../fixincludes/fixlib.h:29,
                 from ../../../fixincludes/fixincl.c:24:
/usr/include/unistd.h:531:14: note: in a call to function ‘getcwd’ declared with attribute ‘access (write_only, 1, 2)’
  531 | extern char *getcwd (char *__buf, size_t __size) __THROW __wur
      |              ^~~~~~
cc1: all warnings being treated as errors

I've sent the fix as
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University

More information about the Gcc-patches mailing list