Re: [PATCH v2 RFA] diagnostic: add permerror variants with opt

2023-10-04 Thread Florian Weimer
* Jason Merrill: > @@ -6159,6 +6153,18 @@ errors by @option{-pedantic-errors}. For instance: > -Wwrite-strings @r{(C++11 or later)} > } > > +@opindex fpermissive > +@item -fpermissive > +Downgrade some required diagnostics about nonconformant code from > +errors to warnings. Thus, using @opt

Principles of the C99 testsuite conversion

2023-10-11 Thread Florian Weimer
I've started to look at what it is required to convert the testsuite to C99 (without implicit ints, without implicit function declarations, and a few other legacy language features). I plan to bundle a bunch of fixes together and submit patches incrementally. So far, I have identified the followi

Re: Principles of the C99 testsuite conversion

2023-10-11 Thread Florian Weimer
* Jeff Law: > On 10/11/23 04:39, Florian Weimer wrote: >> I've started to look at what it is required to convert the testsuite to >> C99 (without implicit ints, without implicit function declarations, and >> a few other legacy language features). > I bet those o

[PATCH] C99 test suite readiness: Mark some C89 tests

2023-10-11 Thread Florian Weimer
Add -std=gnu89 to some tests which evidently target C89-only language features. gcc/testsuite/ * gcc.c-torture/compile/920501-11.c: Compile with -std=gnu89. * gcc.c-torture/compile/920501-23.c: Likewise. * gcc.c-torture/compile/920501-8.c: Likewise. * gcc.c-torture

[PATCH] C99 test suite conversation: Some unverified test case adjustments

2023-10-11 Thread Florian Weimer
These changes are assumed not to interfere with the test objective, but it was not possible to reproduce the historic test case failures (with or without the modification here). gcc/testsuite/ * gcc.c-torture/compile/2105-1.c: Add missing int return type. Call __builtin_exit i

[PATCH] C99 testsuite readiness: Some verified test case adjustments

2023-10-11 Thread Florian Weimer
The updated test cases still reproduce the bugs with old compilers. gcc/testsuite/ * gcc.c-torture/compile/pc44485.c (func_21): Add missing cast. * gcc.c-torture/compile/pr106101.c: Use builtins to avoid calls to undeclared functions. Change type of yyvsp to char

Re: Principles of the C99 testsuite conversion

2023-10-11 Thread Florian Weimer
* Florian Weimer: > * C89 test cases that appear to make explicit use of C89-only features. > I plan to add /* { dg-additional-options "-std=gnu89" } */ to those > (or add -std=gnu89 to an existing dg-options line). These fixes can > be submitted ea

[PATCH] c-family: Enable -fpermissive for C and ObjC

2023-10-19 Thread Florian Weimer
Future changes will treat some C front end warnings similar to -Wnarrowing. There are no new tests because there are no such C warnings yet. The existing test suite covers the -std=gnu89 -pedantic-errors corner cases (which should not turn on -fpermissive). gcc/ * doc/invoke.texi (Warni

Re: [PATCH] i386: Define __HAVE_INDIRECT_RETURN_ATTRIBUTE__

2018-07-19 Thread Florian Weimer
On 07/19/2018 01:33 PM, Jakub Jelinek wrote: On Thu, Jul 19, 2018 at 04:21:26AM -0700, H.J. Lu wrote: The new indirect_return attribute is intended to mark swapcontext in . This patch defines __HAVE_INDIRECT_RETURN_ATTRIBUTE__ so that it can be used checked before using indirect_return attribut

Re: [PATCH] i386: Define __HAVE_INDIRECT_RETURN_ATTRIBUTE__

2018-07-19 Thread Florian Weimer
On 07/19/2018 01:48 PM, H.J. Lu wrote: Both __has_attribute (indirect_return) and __has_attribute (__indirect_return__) work here. Applications can have #define indirect_return so the variant without underscore mangling is definitely not correct. Thanks, Florian

Re: [PATCH] i386: Define __HAVE_INDIRECT_RETURN_ATTRIBUTE__

2018-07-19 Thread Florian Weimer
On 07/19/2018 01:56 PM, Jakub Jelinek wrote: On Thu, Jul 19, 2018 at 01:54:46PM +0200, Florian Weimer wrote: On 07/19/2018 01:48 PM, H.J. Lu wrote: Both __has_attribute (indirect_return) and __has_attribute (__indirect_return__) work here. Applications can have #define indirect_return so

[PATCH] c: Add -Wreturn-mismatch warning, split from -Wreturn-type

2023-10-19 Thread Florian Weimer
The existing -Wreturn-type option covers both constraint violations (which are mandatory to diagnose) and warnings that have known false positives. The new -Wreturn-mismatch warning is only about the constraint violations (missing or extra return expressions), and should eventually be turned into

[PATCH v2] c: Add -Wreturn-mismatch warning, split from -Wreturn-type

2023-10-19 Thread Florian Weimer
The existing -Wreturn-type option covers both constraint violations (which are mandatory to diagnose) and warnings that have known false positives. The new -Wreturn-mismatch warning is only about the constraint violations (missing or extra return expressions), and should eventually be turned into

[PATCH] c: -Wint-conversion should cover pointer/integer mismatches in ?:

2023-10-19 Thread Florian Weimer
gcc/c/ PR c/109827 PR other/44209 * c-typeck.cc (build_conditional_expr): Use OPT_Wint_conversion for pointer/integer mismatch warnings. gcc/testsuite/ * gcc.dg/Wint-conversion-3.c: New. --- gcc/c/c-typeck.cc| 4 ++-- gcc/testsui

[PATCH] c: -Wincompatible-pointer-types should cover mismatches in ?:

2023-10-20 Thread Florian Weimer
gcc/c/ PR c/109826 PR other/44209 * c-typeck.cc (build_conditional_expr): Use OPT_Wincompatible_pointer_types for pointer mismatches. Emit location information for the operand. gcc/testsuite/ * gcc.dg/Wincompatible-pointer-types-4.c: New. *

[PATCH] C99 testsuite readiness: Some unverified test case reductions

2023-10-20 Thread Florian Weimer
gcc/testsuite/ * gcc.c-torture/compile/2412-2.c (f): Call __builtin_strleninstead of strlen. * gcc.c-torture/compile/2427-1.c (FindNearestPowerOf2): Declare. * gcc.c-torture/compile/2802-1.c (bar): Call __builtin_memcpyins

[PATCH] C99 testsuite readiness: Compile more tests with -std=gnu89

2023-10-20 Thread Florian Weimer
gcc/testsuite/ * gcc.c-torture/compile/2403-1.c: Compile with -std=gnu89. * gcc.c-torture/compile/2511-1.c: Likewise. * gcc.c-torture/compile/2804-1.c: Likewise. * gcc.c-torture/compile/20020418-1.c: Likewise. * gcc.c-torture/compile/20020927-1.c

[PATCH] gcc.c-torture/execute/builtins/pr93262-chk.c: Remove return statement

2023-10-22 Thread Florian Weimer
The main_test function returns void, so return with an expression is a constraint violation. The test case still fails with this change applied before the fix for PR 93262 in r14-4813. gcc/testsuite/ * gcc.c-torture/execute/builtins/pr93262-chk.c (main_test): Remove unnecessary r

[PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE

2023-10-22 Thread Florian Weimer
Current glibc headers only declare fputs_unlocked for _GNU_SOURCE. Defining the macro avoids an implicit function declaration. gcc/testsuite/ * gcc.c-torture/execute/builtins/fputs.c (_GNU_SOURCE): Define. --- gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c | 1 + 1 file ch

[PATCH v2] gcc.c-torture/execute/builtins/fputs.c: fputs_unlocked prototype

2023-10-23 Thread Florian Weimer
Current glibc headers only declare fputs_unlocked for _GNU_SOURCE, so define it to obtain an official prototype. Add a fallback prototype declaration for other systems that do not have fputs_unlocked. This seems to the most straightforward approach to avoid an implicit function declaration, witho

Re: [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE

2023-10-23 Thread Florian Weimer
* Andrew Pinski: > On Sun, Oct 22, 2023 at 12:47 AM Florian Weimer wrote: >> >> Current glibc headers only declare fputs_unlocked for _GNU_SOURCE. >> Defining the macro avoids an implicit function declaration. > > This does not help targets that don't use g

[PATCH v2] c-family: Enable -fpermissive for C and ObjC

2023-11-06 Thread Florian Weimer
Future changes will treat some C front end warnings similar to -Wnarrowing. gcc/ * doc/invoke.texi (Warning Options): Mention C diagnostics for -fpermissive. gcc/c-family/ * c.opt (fpermissive): Enable for C and ObjC. * c-opts.cc (set_std_c89): Enable -fpermissiv

Re: [PATCH v2] c-family: Enable -fpermissive for C and ObjC

2023-11-06 Thread Florian Weimer
* Jakub Jelinek: > On Mon, Nov 06, 2023 at 03:06:39PM +0100, Florian Weimer wrote: >> Future changes will treat some C front end warnings similar to >> -Wnarrowing. >> >> gcc/ >> >> * doc/invoke.texi (Warning Options): Mention C diagnostics >&g

Re: [PATCH v2] c-family: Enable -fpermissive for C and ObjC

2023-11-06 Thread Florian Weimer
* Jakub Jelinek: > On Mon, Nov 06, 2023 at 03:19:32PM +0100, Florian Weimer wrote: >> * Jakub Jelinek: >> >> > On Mon, Nov 06, 2023 at 03:06:39PM +0100, Florian Weimer wrote: >> >> Future changes will treat some C front end warnings similar to

[PATCH] c-family: Enable -fpermissive for C and ObjC

2023-11-06 Thread Florian Weimer
Future changes will treat some C front end warnings similar to -Wnarrowing. gcc/ * doc/invoke.texi (Warning Options): Mention C diagnostics for -fpermissive. gcc/c-family/ * c.opt (fpermissive): Enable for C and ObjC. * c-opts.cc (c_common_post_options): Enable -

[PATCH] Avoid undeclared use of abort in gcc.dg/cpp/wchar-1.c

2023-11-06 Thread Florian Weimer
This should be safe because this is a preprocessor test; it should not exercise implicit function declarations. * gcc.dg/cpp/wchar-1.c (main): Call __builtin_abort instead of abort. --- gcc/testsuite/gcc.dg/cpp/wchar-1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

Re: [libstdc++] Use __gthread_join in jthread/95989

2023-03-03 Thread Florian Weimer
* Alexandre Oliva via Gcc-patches: > +// Make sure it's not optimized out, not even with LTO. > +asm ("" : : "rm" (depend)); If the m constraint is used, this may never emit the symbol name and thus not create a reference after all.

Re: [PATCH] Ignore the clobbered stack pointer in asm statment

2020-09-12 Thread Florian Weimer
* H. J. Lu via Gcc-patches: > + inform (input_location, "the value of the stack pointer after" > + " an % statement must be the same as it was" > + " before the statement"); Would it make sense to generate a stronger worded warning when generating asynchronous un

Re: [PATCH] Ignore the clobbered stack pointer in asm statment

2020-09-12 Thread Florian Weimer
* Jakub Jelinek: > On Sat, Sep 12, 2020 at 07:37:36PM +0200, Florian Weimer wrote: >> * H. J. Lu via Gcc-patches: >> >> > +inform (input_location, "the value of the stack pointer after" >> > +" an % statement must be the same as

Re: [committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-09-27 Thread Florian Weimer
* Jonathan Wakely via Libstdc: > We can't use __libc_single_threaded to replace __gthread_active_p > everywhere. If we replaced the uses of __gthread_active_p in std::mutex > then we would elide the pthread_mutex_lock in the code below, but not > the pthread_mutex_unlock: > > std::mutex m; > m

[PATCH] i386: Define __LAHF_SAHF__ and __MOVBE__ macros, based on ISA flags

2020-09-29 Thread Florian Weimer
It looks like these have been omitted by accident. gcc/ * config/i386/i386-c.c (ix86_target_macros_internal): Define __LAHF_SAHF__ and __MOVBE__ based on ISA flags. --- gcc/config/i386/i386-c.c | 4 1 file changed, 4 insertions(+) diff --git a/gcc/config/i386/i386-c.c b/gcc

[PATCH] PR target/97250: i386: Add support for x86-64-v2, x86-64-v3, x86-64-v4 levels for x86-64

2020-09-30 Thread Florian Weimer
These micro-architecture levels are defined in the x86-64 psABI: https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/77566eb03bc6a326811cb7e9 PTA_NO_TUNE is introduced so that the new processor alias table entries do not affect the CPU tuning setting in ix86_tune. The tests depend on the macros ad

Re: [PATCH] PR target/97250: i386: Add support for x86-64-v2, x86-64-v3, x86-64-v4 levels for x86-64

2020-09-30 Thread Florian Weimer
* Uros Bizjak: > On Wed, Sep 30, 2020 at 2:27 PM Florian Weimer wrote: >> >> These micro-architecture levels are defined in the x86-64 psABI: >> >> https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/77566eb03bc6a326811cb7e9 >> >> PTA_NO_TUNE is introduce

Re: [PATCH] PR target/97250: i386: Add support for x86-64-v2, x86-64-v3, x86-64-v4 levels for x86-64

2020-09-30 Thread Florian Weimer
* Jakub Jelinek: > On Wed, Sep 30, 2020 at 02:27:38PM +0200, Florian Weimer wrote: >> --- a/gcc/doc/invoke.texi >> +++ b/gcc/doc/invoke.texi >> @@ -29258,6 +29258,13 @@ of the selected instruction set. >> @item x86-64 >> A generic CPU with 64-bit extensions. &g

Re: [PATCH] PR target/97250: i386: Add support for x86-64-v2, x86-64-v3, x86-64-v4 levels for x86-64

2020-09-30 Thread Florian Weimer
* Jakub Jelinek: > On Wed, Sep 30, 2020 at 04:05:41PM +0200, Florian Weimer wrote: >> > I think the documentation should state that these are not valid in -mtune=, >> > just in -march=, and that using -march=x86-64-v* will not change tuning. >> > I guess there sho

Re: [PATCH] PR target/97250: i386: Add support for x86-64-v2, x86-64-v3, x86-64-v4 levels for x86-64

2020-09-30 Thread Florian Weimer
* Jakub Jelinek: > On Wed, Sep 30, 2020 at 04:29:34PM +0200, Florian Weimer wrote: >> > Thinking about it more, wouldn't it better to just imply generic tuning >> > for these -march= options? >> >> I think this is what the patch does? See the x86-64-v3-hasw

Re: [RFC] Characters per line: from punch card (80) to line printer (132)

2019-12-05 Thread Florian Weimer
* Paul Koning: > That's certainly a general rule. There is a reason why books aren't > wide, and why newspapers have columns. The eye can't deal well with > long lines. So while 132 column lines are certainly possible with > modern computers, it doesn't mean they are desirable. If the line sta

Re: [PATCH] include/longlong.h: Remove incorrect lvalue to rvalue conversion from asm output constraints

2021-10-10 Thread Florian Weimer
* Fangrui Song: > An output constraint takes a lvalue. While GCC happily strips the > incorrect lvalue to rvalue conversion, Clang rejects the code by default: > > error: invalid use of a cast in a inline asm context requiring an lvalue: > remove the cast or build with -fheinous-gnu-extension

Re: [PATCH] libquadmath: printf: fix misaligned access on args

2024-04-02 Thread Florian Weimer
* Simon Chopin: > On x86, this compiles into movdqa which segfaults on unaligned access. > > This kind of failure has been seen when running against glibc 2.39, > which incidentally changed the printf implementation to move away from > alloca() for this data to instead append it at the end of an e

[PATCH] Notes on the warnings-as-errors change in GCC 14

2024-02-02 Thread Florian Weimer
--- htdocs/gcc-14/porting_to.html | 465 ++ 1 file changed, 465 insertions(+) diff --git a/htdocs/gcc-14/porting_to.html b/htdocs/gcc-14/porting_to.html index 3e4cedc3..4c8f9c8f 100644 --- a/htdocs/gcc-14/porting_to.html +++ b/htdocs/gcc-14/porting_to.html

Re: [PATCH] Notes on the warnings-as-errors change in GCC 14

2024-02-15 Thread Florian Weimer
* Jonathan Wakely: >>+To fix the remaining int-conversions issues, add casts >>+to an appropriate pointer or integer type. On GNU systems, the >>+standard (but generally optional) types > > I know what you mean here, but I'm not sure the parenthesis adds > clarity for anybody who doesn't already

Re: [PATCH] Notes on the warnings-as-errors change in GCC 14

2024-02-15 Thread Florian Weimer
* Sam James: > It's fine if you leave this out, but consider mentioning the common > pitfall of autoconf projects not including config.h consistently before > all inclues. We could also mention AC_USE_SYSTEM_EXTENSIONS. I added: “ Alternatively, projects using using Autoconf could enable AC_USE

Re: [PATCH] Notes on the warnings-as-errors change in GCC 14

2024-02-15 Thread Florian Weimer
* Gerald Pfeifer: >> This mostly happens in function definitions >> +that are not prototypes > > Naive questions: Can definitions really be prototypes (in C)? Yes, I think so: definitions can be declarations, and function prototypes are declarations. The standard uses the phrase “function defin

Re: [PATCH] Notes on the warnings-as-errors change in GCC 14

2024-02-15 Thread Florian Weimer
* Gerald Pfeifer: > On Fri, 2 Feb 2024, Florian Weimer wrote: >> htdocs/gcc-14/porting_to.html | 465 >> ++ >> 1 file changed, 465 insertions(+) >> + >> +Using pointers as integers and vice versa >> (-Werror=

Re: [PATCH] Notes on the warnings-as-errors change in GCC 14

2024-02-15 Thread Florian Weimer
* Gerald Pfeifer: > On Fri, 2 Feb 2024, Florian Weimer wrote: >> +Certain warnings are now errors > > That's quite a nice description, thank you, Florian! > >> +The initial ISO C standard and its 1999 revision removed support for > > May I suggest to wrap paragr

[PATCH wwwdocs] CSS: Color markup for /

2024-02-17 Thread Florian Weimer
In addition to underlines and strikethroughs. This makes it easier to spot the differences in example code changes. --- htdocs/gcc.css | 4 1 file changed, 4 insertions(+) diff --git a/htdocs/gcc.css b/htdocs/gcc.css index 77d01ee0..e32c4b93 100644 --- a/htdocs/gcc.css +++ b/htdocs/gcc.css

[PATCH wwwdocs] gcc-14: Add code examples for -Wreturn-mismatch

2024-02-17 Thread Florian Weimer
--- htdocs/gcc-14/porting_to.html | 46 --- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/htdocs/gcc-14/porting_to.html b/htdocs/gcc-14/porting_to.html index bbbaa25a..123b5e9f 100644 --- a/htdocs/gcc-14/porting_to.html +++ b/htdocs/gcc-14/p

[PATCH wwwdocs] gcc-14: Some very common historic Autoconf probes that no longer work

2024-02-17 Thread Florian Weimer
--- htdocs/gcc-14/porting_to.html | 43 +++ 1 file changed, 43 insertions(+) diff --git a/htdocs/gcc-14/porting_to.html b/htdocs/gcc-14/porting_to.html index 123b5e9f..ab65c5e7 100644 --- a/htdocs/gcc-14/porting_to.html +++ b/htdocs/gcc-14/porting_to.html @

[PATCH wwwdocs COMMITTED] gcc-14: Fix unintentional error in -Wimplicit-int example

2024-02-19 Thread Florian Weimer
diff --git a/htdocs/gcc-14/porting_to.html b/htdocs/gcc-14/porting_to.html index bbbaa25a..901a1653 100644 --- a/htdocs/gcc-14/porting_to.html +++ b/htdocs/gcc-14/porting_to.html @@ -92,7 +92,7 @@ below). In the example below, the type of s should be write_string (fd, s) { -write (1,

[PATCH] c-family: Use -Wdiscarded-qualifiers for ignored qualifiers in __atomic_*

2023-12-17 Thread Florian Weimer
This matches other compiler diagnostics. No test updates are needed because c-c++-common/pr95378.c does not match a specific -W option. Fixes commit d2384b7b24f8557b66f6958a05ea99ff4307e75c ("c-family: check qualifiers of arguments to __atomic built-ins (PR 95378)"). gcc/c-family/ PR c/

Re: [PATCH v3 04/11] Add tests for validating future C permerrors

2023-11-30 Thread Florian Weimer
* Marek Polacek: >> +void >> +implicit_function_declaration (void) >> +{ >> + f1 (); /* { dg-warning "'f1' \\\[-Wimplicit-function-declaration\\\]" } */ >> +} >> + >> +extern implicit_int_1; /* { dg-warning "'implicit_int_1' >> \\\[-Wimplicit-int\\\]" } */ > > Oy, these \ tend to get unwieldy.

Re: [PATCH v3 05/11] c: Turn int-conversion warnings into permerrors

2023-11-30 Thread Florian Weimer
* Marek Polacek: >> permerror_init for -Wint-conversion warnings. > > A few extra whitespaces. >> * gcc.dg/assign-warn-4.c: New file. Extracted from >> assign-warn1.c. Expect int-cnversion errors. > > "int-conversion" (sorry about pointing out typos...) > >> * gcc.dg/dia

Re: [PATCH v3 10/11] c: Turn -Wincompatible-pointer-types into a permerror

2023-11-30 Thread Florian Weimer
* Marek Polacek: > On Mon, Nov 20, 2023 at 10:56:36AM +0100, Florian Weimer wrote: >> --- a/gcc/doc/invoke.texi >> +++ b/gcc/doc/invoke.texi >> @@ -6183,6 +6183,7 @@ that have their own flag: >> @gccoptlist{ >> -Wimplicit-function-declaration

Re: [PATCH v3 10/11] c: Turn -Wincompatible-pointer-types into a permerror

2023-11-30 Thread Florian Weimer
* Jakub Jelinek: > On Thu, Nov 30, 2023 at 04:15:26PM -0500, Marek Polacek wrote: >> On Thu, Nov 30, 2023 at 10:11:31PM +0100, Florian Weimer wrote: >> > * Marek Polacek: >> > >> > > On Mon, Nov 20, 2023 at 10:56:36AM +0100, Florian Weimer wrote: >>

Re: [PATCH v3 00/11] : More warnings as errors by default

2023-11-30 Thread Florian Weimer
* Sam James: >>> But give Marek additional time to chime in, particularly given the >>> holidays this week in the US. Say through this time next week? >> >> [...] >> >> I'm also gathering some numbers regarding autoconf impact and potential >> silent miscompilation. > > I'd actually forgot about

Re: [PATCH 2/6] c: Turn int-conversion warnings into permerrors

2023-12-01 Thread Florian Weimer
* 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:

Re: [PATCH] testsuite: Tweak some further tests for modern C changes

2023-12-01 Thread Florian Weimer
* Jakub Jelinek: > Hi! > > On IRC Richi mentioned some FAILs in gcc.target/x86_64 and in pr83126.c. > > The following patch fixes the former ones (they need recent binutils to > be enabled), for pr83126.c because I didn't have graphite configured I've > just verified that the test compiles (didn't

[PATCH] libgcov: Call __builtin_fork instead of fork

2023-12-02 Thread Florian Weimer
Some targets do not provide a prototype for fork, and compilation now fails with an implicit-function-declaration error. libgcc/ * libgcov-interface.c (__gcov_fork): Generated code is the same on x86_64-linux-gnu. Okay for trunk? Thanks, Florian --- libgcc/libgcov-interface.c | 2 +-

Re: [committed] Fix gnu23-builtins-no-dfp

2023-12-02 Thread Florian Weimer
* Jeff Law: > Anyway, this test was the one I was most concerned about. Basically > we're testing that on a !dfp target that the builtins are not available. > It expects a warning, but gets an error by default now. I just > changed the test to use -fpermissive, so that the test behaves as i

Re: [PATCH v3 10/11] c: Turn -Wincompatible-pointer-types into a permerror

2023-12-05 Thread Florian Weimer
* Richard Earnshaw: > (I think it's this patch, not one of the others in the series). > > This breaks building libgfortran with newlib on arm and aarch64: > > > /work/rearnsha/gnusrc/nightly/gcc-cross/master/libgfortran/io/list_read.c:2208:46: > error: pointer type mismatch in conditional expressi

Re: [PATCH] libgfortran: Fix -Wincompatible-pointer-types errors

2023-12-05 Thread Florian Weimer
* Richard Earnshaw: > On 05/12/2023 10:51, Jakub Jelinek wrote: >> On Tue, Dec 05, 2023 at 10:47:34AM +, Richard Earnshaw wrote: The following patch makes libgfortran build on i686-linux after hacking up --- kinds.h.xx 2023-12-05 00:23:00.133365064 +0100 +++ kinds.h2

Re: [PATCH] testsuite: Adjust for the new permerror -Wincompatible-pointer-types

2023-12-06 Thread Florian Weimer
* Yang Yujie: > From: Yang Yujie > Subject: [PATCH] testsuite: Adjust for the new permerror > -Wincompatible-pointer-types > To: gcc-patches@gcc.gnu.org > Cc: r...@cebitec.uni-bielefeld.de, mikest...@comcast.net, fwei...@redhat.com, > Yang Yujie > Date: Wed, 6 Dec 2023 10:29:31 +0800 (9 hours

Re: [PATCH v3 10/11] c: Turn -Wincompatible-pointer-types into a permerror

2023-12-06 Thread Florian Weimer
* Prathamesh Kulkarni: > On Mon, 20 Nov 2023 at 15:28, Florian Weimer wrote: >> >> The change to build_conditional_expr drops the downgrade >> from a pedwarn to warning for builtins for C99 and later >> language dialects. It remains a warning in C89 mode (not >>

Re: [PATCH] testsuite: Adjust for the new permerror -Wincompatible-pointer-types

2023-12-07 Thread Florian Weimer
* Yang Yujie: > With this patch, I also noticed a few errors in building unpatched older > software like expect-5.45.4, perl-5.28.3 and bash-5.0. Will this also be > the case when GCC 14 gets released? For Fedora, we keep pointers of the changes needed here:

Re: [PATCH] libgcov: Call __builtin_fork instead of fork

2023-12-08 Thread Florian Weimer
* Jakub Jelinek: > On Sat, Dec 02, 2023 at 01:43:22PM +0100, Florian Weimer wrote: >> Some targets do not provide a prototype for fork, and compilation now >> fails with an implicit-function-declaration error. >> >> libgcc/ >> >> * libgcov-interface.c

Re: [PATCH v3 11/11] c: Add new -Wdeclaration-missing-parameter-type permerror

2023-12-11 Thread Florian Weimer
* Marek Polacek: > On Mon, Nov 20, 2023 at 10:56:42AM +0100, Florian Weimer wrote: >> This used to be a warning, enabled by default, without its own option. > > I think this patch is OK now. > >> A subsequent change could improve diagnostics and provide spelling >&g

Re: [RFC] Intel AVX10.1 Compiler Design and Support

2023-12-12 Thread Florian Weimer
* Richard Biener: > If it were possible I'd axe x86_64-v4. Maybe we should add a x86_64-v3.5 > that sits inbetween v3 and v4, offering AVX512 but restricted to 256bit > (and obviously not requiring more of the AVX512 features that v4 > requires). As far as I understand it, GCC's Intel tuning for

[PATCH v3] c-family: Enable -fpermissive for C and ObjC

2023-11-07 Thread Florian Weimer
Future changes will treat some C front end warnings similar to -Wnarrowing. gcc/ * doc/invoke.texi (Warning Options): Mention C diagnostics for -fpermissive. gcc/c-family/ * c.opt (fpermissive): Enable for C and ObjC. * c-opts.cc (c_common_post_options): Enable -

Re: [PATCH v2] c: Add -Wreturn-mismatch warning, split from -Wreturn-type

2023-11-07 Thread Florian Weimer
* Florian Weimer: > The existing -Wreturn-type option covers both constraint violations > (which are mandatory to diagnose) and warnings that have known > false positives. The new -Wreturn-mismatch warning is only about > the constraint violations (missing or extra return express

[PATCH] gcc.dg/Wmissing-parameter-type*: Test the intended warning

2023-11-08 Thread Florian Weimer
gcc/testsuite/ChangeLog: * gcc.dg/Wmissing-parameter-type.c: Build with -std=gnu89 to trigger the -Wmissing-parameter-type warning and not the default -Wimplicit warning. Also match against -Wmissing-parameter-type. * gcc.dg/Wmissing-parameter-type.c: Likew

Re: [PATCH 1/3] tree-ssa-sink: do not sink to in front of setjmp

2023-11-08 Thread Florian Weimer
* Alexander Monakov via Gcc-patches: > diff --git a/gcc/testsuite/gcc.dg/setjmp-7.c b/gcc/testsuite/gcc.dg/setjmp-7.c > new file mode 100644 > index 0..44b5bcbfa > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/setjmp-7.c > @@ -0,0 +1,13 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -f

[PATCH] Improve C99 compatibility of gcc.dg/setjmp-7.c test

2023-11-08 Thread Florian Weimer
gcc/testsuite/ChangeLog: * gcc.dg/setjmp-7.c (_setjmp): Declare. --- gcc/testsuite/gcc.dg/setjmp-7.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/testsuite/gcc.dg/setjmp-7.c b/gcc/testsuite/gcc.dg/setjmp-7.c index 44b5bcbfa9d..579542380ba 100644 --- a/gcc/testsuite/gcc.dg/setj

[PATCH] i386: Fix C99 compatibility issues in the x86-64 AVX ABI test suite

2023-11-08 Thread Florian Weimer
* gcc.target/x86_64/abi/avx/avx-check.h (main): Call __builtin_printf instead of printf. * gcc.target/x86_64/abi/avx/test_passing_m256.c (fun_check_passing_m256_8_values): Add missing void return type. * gcc.target/x86_64/abi/avx512f/avx512f-check.h (

Re: [PATCH] i386: Fix C99 compatibility issues in the x86-64 AVX ABI test suite

2023-11-09 Thread Florian Weimer
* Jakub Jelinek: > On Wed, Nov 08, 2023 at 03:55:17PM +0100, Florian Weimer wrote: >> * gcc.target/x86_64/abi/avx/avx-check.h (main): Call >> __builtin_printf instead of printf. >> * gcc.target/x86_64/abi/avx/test_passing_m256.c >> (fun_check_

[PATCH] aarch64: Call named function in gcc.target/aarch64/aapcs64/ice_1.c

2023-11-10 Thread Florian Weimer
This test looks like it intends to pass a small struct argument through both a non-variadic and variadic argument, but due to the typo, it does not achieve that. gcc/testsuite/ * gcc.target/aarch64/aapcs64/ice_1.c (foo): Call named. --- gcc/testsuite/gcc.target/aarch64/aapcs64/ice_1.c |

[PATCH] aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder

2023-11-10 Thread Florian Weimer
* config/aarch64/linux-unwind.h (aarch64_fallback_frame_state): Add cast to the expected type in sc assignment. (Almost a v2, but the other issue was already fixed via in r14-4183.) --- libgcc/config/aarch64/linux-unwind.h | 5 - 1 file changed, 4 insertions(+), 1 del

[PATCH] C99 testsuite readiness: -fpermissive tests

2023-11-10 Thread Florian Weimer
These tests use obsolete language constructs, but they are not clearly targeting C89, either. So use -fpermissive to keep future errors as warnings. The reasons why obsolete constructs are used used vary from test to test. Some tests deliberately exercise later stages of the compiler that only o

[PATCH] C99 testsuite readiness: Verified un-reductions

2023-11-10 Thread Florian Weimer
gcc/testsuite/ * gcc.c-torture/compile/20080613-1.c (hop_sendmsg): Call __builtin_memcpy instead of memcpy. * gcc.c-torture/compile/complex-6.c (bar): Declare. * gcc.c-torture/compile/pr23445.c (__brelse): Declare. * gcc.c-torture/compile/pr23946.c (long2str)

[PATCH] C99 testsuite readiness: More unverified testcase un-reductions

2023-11-10 Thread Florian Weimer
gcc/testsuite/ * gcc.c-torture/compile/BUG17.c (main): Add missing int return type and missing void type. * gcc.c-torture/compile/BUG18.c (main): Likewise. Call __builtin_printf instead of printf. * gcc.c-torture/compile/BUG21.c (Nase): Add missing void

[PATCH] C99 testsuite readiness: Compile more tests with -std=gnu89

2023-11-10 Thread Florian Weimer
gcc/testsuite/ * gcc.c-torture/compile/386.c: Compile with -std=gnu89. * gcc.c-torture/compile/BUG1.c: Likewise. * gcc.c-torture/compile/BUG11.c: Likewise. * gcc.c-torture/compile/BUG16.c: Likewise. * gcc.c-torture/compile/BUG2.c: Likewise. * gcc.c-t

Re: [PATCH] C99 testsuite readiness: Compile more tests with -std=gnu89

2023-11-11 Thread Florian Weimer
* Jeff Law: > OK. Spot checked. It looked like -fpermissive was added for some as > well, which is fine by me. Perhaps "Compile with -std=gnu89 and > possibly -fpermissive as needed" or something similar in the > ChangeLog. There was one test that had -std=gnu89 -fpermissive. But -fpermissive

Re: [PATCH] C99 testsuite readiness: -fpermissive tests

2023-11-11 Thread Florian Weimer
* Eric Gallager: >> diff --git a/gcc/testsuite/gcc.c-torture/compile/20080910-1.c >> b/gcc/testsuite/gcc.c-torture/compile/20080910-1.c >> index bf32775d401..911fb562790 100644 >> --- a/gcc/testsuite/gcc.c-torture/compile/20080910-1.c >> +++ b/gcc/testsuite/gcc.c-torture/compile/20080910-1.c >> @

Re: Principles of the C99 testsuite conversion

2023-11-13 Thread Florian Weimer
These changes are now in, for i686-linux-gnu, powerpc64le-linux-gnu, x86_64-linux-gnu. For aarch64-linux-gnu, there's one change that would benefit from maintainer review: [PATCH] aarch64: Call named function in gcc.target/aarch64/aapcs64/ice_1.c

[PATCH] gm2: Add missing declaration of m2pim_M2RTS_Terminate to test

2023-11-13 Thread Florian Weimer
Needed for C99 testsuite compatibility. gcc/testsuite/ * gm2/link/externalscaffold/pass/scaffold.c (m2pim_M2RTS_Terminate): Declare. --- gcc/testsuite/gm2/link/externalscaffold/pass/scaffold.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/testsuite/gm2/link/externalsca

[PATCH 0/6] Turn some C warnings into errors by default

2023-11-13 Thread Florian Weimer
inbox.sourceware.org/gcc-patches/87r0kx6eez@oldenburg.str.redhat.com/> Recently, I also found a problem in the gm2 testsuite: [PATCH] gm2: Add missing declaration of m2pim_M2RTS_Terminate to test <https://inbox.sourceware.org/gcc-patches/874jhp3nwf@oldenburg.str.redhat.com/> Th

[PATCH 1/6] c-family: Introduce pedpermerror

2023-11-13 Thread Florian Weimer
It turns out that permerror_opt is not directly usable for -fpermissive in the C front end. The front end uses pedwarn extensively, and pedwarns are not overridable by -Wno-* options, yet permerrors are. Add new pedpermerror helpers that turn into pedwarns if -pedantic-errors is active. Due to t

[PATCH 2/6] c: Turn int-conversion warnings into permerrors

2023-11-13 Thread Florian Weimer
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_

[PATCH 3/6] c: Turn -Wimplicit-function-declaration into a pedpermerror

2023-11-13 Thread Florian Weimer
In the future, it may make sense to avoid cascading errors from the implicit declaration, especially its assumed int return type. This change here only changes the kind of the diagnostic, not its wording or consequences. gcc/c/ * doc/invoke.texi (Warning Options): Document changes. gcc/c

[PATCH 4/6] c: Turn -Wimplicit-int into a pedpermerror

2023-11-13 Thread Florian Weimer
There is a missed opportunity here to issue spelling diagnostics in prototype declarations (e.g., for “extern int foo (int32t);”). gcc/ * doc/invoke.texi (Warning Options): Document changes. gcc/c/ * c-decl.cc (warn_defaults_to): Call emit_diagnostic_valist instead of re

[PATCH 5/6] c: Turn -Wreturn-mismatch into a pedpermerror

2023-11-13 Thread Florian Weimer
gcc/ * doc/invoke.texi (Warning Options): Document changes. gcc/c/ * c-typeck.cc (c_finish_return): Issue a permerror for mismatching pointers to builtins. For mismatching other pointers, issue a pedpermerror. gcc/testsuite/ * gcc.dg/20030906-1.c: Compi

[PATCH 6/6] c: Turn -Wincompatible-pointer-types into a pedpermerror

2023-11-13 Thread Florian Weimer
gcc/ * doc/invoke.texi (Warning Options): Document changes. gcc/c/ * c-typeck.cc (build_conditional_expr): Use pedpermerror- equivalent for pointer type mismatches in conditional expression. (convert_for_assignment): Use pedpermerror and pedpermerr

Re: [PATCH 1/6] c-family: Introduce pedpermerror

2023-11-13 Thread Florian Weimer
* Florian Weimer: > It turns out that permerror_opt is not directly usable for > -fpermissive in the C front end. The front end uses pedwarn > extensively, and pedwarns are not overridable by -Wno-* options, > yet permerrors are. Add new pedpermerror helpers that turn into &

[PATCH v2 0/8] Turn some C warnings into errors by default

2023-11-14 Thread Florian Weimer
c-patches/874jhp3nwf@oldenburg.str.redhat.com/> Thanks, Florian Florian Weimer (8): Add tests for validating future C permerrors c: Turn int-conversion warnings into permerrors c: Turn -Wimplicit-function-declaration into a permerror c: Turn -Wimplicit-int into a permerror c: Do not ignore some for

[PATCH v2 1/8] Add tests for validating future C permerrors

2023-11-14 Thread Florian Weimer
The dg-error directives for gcc.dg/permerror-system.c can be generated using (for the most part at least): perl -ne 'print if s,.*(/\* \{ dg-error .*) } \*/$,$1 "" { target *-*-* } $. } */,' \ < gcc/testsuite/gcc.dg/permerror-default.c gcc/testsuite/ * gcc.dg/permerror-default.c: New

[PATCH v2 2/8] c: Turn int-conversion warnings into permerrors

2023-11-14 Thread Florian Weimer
gcc/ * doc/invoke.texi (Warning Options): Document changes. gcc/c/ PR c/96284 PR c/106416 * c-typeck.cc (build_conditional_expr): Use permerror_opt for pointer/integer type mismatches, based on -Wint-conversion. (pedwarn_permerror_init, permerror_i

[PATCH v2 3/8] c: Turn -Wimplicit-function-declaration into a permerror

2023-11-14 Thread Florian Weimer
In the future, it may make sense to avoid cascading errors from the implicit declaration, especially its assumed int return type. This change here only changes the kind of the diagnostic, not its wording or consequences. gcc/ * doc/invoke.texi (Warning Options): Document changes. gcc/c/

[PATCH v2 6/8] c: Turn -Wreturn-mismatch into a permerror

2023-11-14 Thread Florian Weimer
gcc/ * doc/invoke.texi (Warning Options): Document changes. gcc/c/ PR c/96284 * c-typeck.cc (c_finish_return): Use permerrors for OPT_Wreturn_mismatch diagnostics. gcc/testsuite/ * gcc.dg/permerror-default.c (return_mismatch_1) (return_mismatch_2

[PATCH v2 4/8] c: Turn -Wimplicit-int into a permerror

2023-11-14 Thread Florian Weimer
Most of these new permerrors are currently not diagnosed in system headers. gcc/ PR c/91093 PR c/96284 * doc/invoke.texi (Warning Options): Document changes. gcc/c/ * c-decl.cc (warn_defaults_to): Remove. (grok_declarator, start_function): Call permerror_

[PATCH v2 7/8] c: Turn -Wincompatible-pointer-types into a permerror

2023-11-14 Thread Florian Weimer
The change to build_conditional_expr drops the downgrade from a pedwarn to warning for builtins. gcc/ * doc/invoke.texi (Warning Options): Document changes. gcc/c/ PR c/96284 * c-typeck.cc (build_conditional_expr): Upgrade most pointer type mismatches to a permer

[PATCH v2 5/8] c: Do not ignore some forms of -Wimplicit-int in system headers

2023-11-14 Thread Florian Weimer
Most -Wimplicit-int warnings were unconditionally disabled for system headers. Only missing types for parameters in old-style function definitions resulted in warnings. This is inconsistent with the treatment of other permerrors, which are active in system headers. gcc/c/ * c-decl.cc (g

  1   2   3   4   5   6   >