From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B564B3858426 for ; Fri, 12 May 2023 20:18:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B564B3858426 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683922711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ApA90aaWXWztcoYK89B77EbHRYkIhar9JfeETjqrRec=; b=glW2y9GdKYyI7LZiDeNao6hSA7jcT+E4G+9kTQjDxlqwDb2m+and6jAzeHoEDRXUEXRWrL hukpJuk3OUTpjAJN4fvv8YiMbahbzzhVl+yfWSqviGGF6d0St468YWoAM6kULSe8y0DBmx tyr1QIa/2XineWDbjqnUrdIcOLsE9kI= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-42-HffrRtv9OKa05SJ-hGBXog-1; Fri, 12 May 2023 16:18:30 -0400 X-MC-Unique: HffrRtv9OKa05SJ-hGBXog-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-76c7107b84bso230966639f.3 for ; Fri, 12 May 2023 13:18:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683922709; x=1686514709; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ApA90aaWXWztcoYK89B77EbHRYkIhar9JfeETjqrRec=; b=JEa25Y8KkwTaLIIpzzZB72i3TsJnY3pddFM1c8WxEw1gSzn/8GrKLoJRQXKHxra/nY R+EgvnXrJ+PkyvRCq0hyyLrhwPYqVTh+BYszIuDLoouQPwINKalLcAP6ySjF5/5nQSAM 3uyxxXC30RPtKJH5GjJ9ErMuvRen0+uwj5jXV4WZPORiljBR+9/laqu6i6oHUX3xllCK qJnyQ+0opRkwdTwFAzD+MCzUBXBWSfaMnWH0Cj0Y5ofEK01BMh/T28zUIvEucr9x7x+o 8j5Aj3jzgLK0DWAn7oL5OJSNmucI+Z4gAxQ1wTbVrq/y8faNOYU7woeHNLy+WG+ynR37 jOJg== X-Gm-Message-State: AC+VfDzcwkhNJAxc6ocyayChZEE/ytiVrT60/xTRbZyNtHXtqaHX2J7t W4VrUU7Ygl4+gekC7SXE2EFryu/MbGkNh+ZHx1DViNUNi78/+W4byApm3Q5ZaSy2Jr1CqpyXk/p h6QXwZgO9vQ2cnv9tu0fKrdQ= X-Received: by 2002:a5d:8194:0:b0:760:ced3:4481 with SMTP id u20-20020a5d8194000000b00760ced34481mr15709027ion.4.1683922709703; Fri, 12 May 2023 13:18:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5os4CWuRneteBbBRmyCHiWNi+uM7QccuI448aII9zL4Of2yWH+6oCp3RIanODs1k6xrcoRbjNI6jeCEi+UzXQ= X-Received: by 2002:a5d:8194:0:b0:760:ced3:4481 with SMTP id u20-20020a5d8194000000b00760ced34481mr15709021ion.4.1683922709389; Fri, 12 May 2023 13:18:29 -0700 (PDT) MIME-Version: 1.0 References: <87y1lx1avj.fsf@oldenburg.str.redhat.com> <83ednoapb6.fsf@gnu.org> <831qjoa0g0.fsf@gnu.org> <83o7ms8is7.fsf@gnu.org> <2ffbf210-1b58-737b-888c-4f84c5cc5e0f@gmail.com> <837ctg8e98.fsf@gnu.org> <83wn1g6w67.fsf@gnu.org> <83mt2c6tch.fsf@gnu.org> <871qjlh9t3.fsf@mid.deneb.enyo.de> In-Reply-To: <871qjlh9t3.fsf@mid.deneb.enyo.de> From: Jason Merrill Date: Fri, 12 May 2023 16:18:18 -0400 Message-ID: Subject: Re: More C type errors by default for GCC 14 To: Florian Weimer Cc: Joseph Myers , Eli Zaretskii , Jakub Jelinek , gabravier@gmail.com, jwakely.gcc@gmail.com, fweimer@redhat.com, gcc@gcc.gnu.org, arsen@aarsen.me X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, May 12, 2023 at 11:03=E2=80=AFAM Florian Weimer = wrote: > > * Joseph Myers: > > > On Wed, 10 May 2023, Eli Zaretskii via Gcc wrote: > > > >> That is not the case we are discussing, AFAIU. Or at least no one has > >> yet explained why accepting those old K&R programs will adversely > >> affect the ability of GCC to compile C2x programs. > > > > At block scope, > > > > auto x =3D 1.5; > > > > declares x to have type double in C2x (C++-style auto), but type int in > > C89 (and is invalid for versions in between). In this case, there is a= n > > incompatible semantic change between implicit int and C++-style auto. > > Giving an error before we make -std=3Dgnu2x the default seems like a > > particularly good idea, to further alert anyone who has been ignoring t= he > > warnings about implicit int that semantics will change incompatibly. > > Obviously makes sense to me. Agreed. But we could safely continue to accept static x =3D 42; or even auto x =3D 42; // meaning of 'auto' changes, meaning of the declaration d= oes not We might make -Wimplicit-int an error by default only if the initializer has a type other than 'int'. > > In cases where the standard requires a diagnostic, some are errors, som= e > > are pedwarns-by-default or unconditional pedwarns, some are > > pedwarns-if-pedantic - the choice depending on how suspicious the > > construct in question is and whether it corresponds to a meaningful > > extension (this is not making an automatic choice for every such situat= ion > > in the standard, it's a case-by-case judgement by maintainers). By now= , > > the cases discussed in this thread are sufficiently suspicious - > > sufficiently likely to result in unintended execution at runtime (not, = of > > course, reliably detected because programs with such dodgy code are ver= y > > unlikely to have thorough automated tests covering all their code) - th= at > > is it in the interests of users for them to be errors by default (for C= 99 > > and later modes, in the cases that were valid in C89). > > Just to recap, those are controlled by > -Wimplicit-function-declaration, -Wimplicit-int, -Wint-conversion, and > -Wincompatible-pointer-types, roughly in increasing order of > compatibility impact with old sources. What would the impact be of making -Wint-conversion an error by default only if the types are different sizes? Jason