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 3D5153858D28 for ; Tue, 10 Oct 2023 16:38:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D5153858D28 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=1696955907; h=from:from:reply-to: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=niP9Zuoo4QtjIyERmeRYvGhoX/9lDsp9U416H3LgChA=; b=a7aA8EI5O3QXHiYt+NODeAE73PBguymd1kV6RxDfd7G5dKpf+iNA5LGLPCi8j4+XnIDZqp 0wydVbp7tUIn8gQXtrsz17VuNC47/U/u47PzthHURGKBOZfbQb15voFW+hY87ABKk4ctob HEvpQR7arJFKyKHk9uqIIQAV92rT0sM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-680-MaltmUYOP1KuqpYHkwXQkQ-1; Tue, 10 Oct 2023 12:38:26 -0400 X-MC-Unique: MaltmUYOP1KuqpYHkwXQkQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7B5DB811E88 for ; Tue, 10 Oct 2023 16:38:26 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DE3B20807E4; Tue, 10 Oct 2023 16:38:26 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 39AGcNvo3657390 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 10 Oct 2023 18:38:24 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 39AGcNEW3657389; Tue, 10 Oct 2023 18:38:23 +0200 Date: Tue, 10 Oct 2023 18:38:23 +0200 From: Jakub Jelinek To: Jason Merrill Cc: Florian Weimer , gcc@gcc.gnu.org Subject: Re: C89 question: Do we need to accept -Wint-conversion warnings Message-ID: Reply-To: Jakub Jelinek References: <87h6myaf6b.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham 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 Tue, Oct 10, 2023 at 12:30:52PM -0400, Jason Merrill via Gcc wrote: > On Tue, Oct 10, 2023 at 7:30 AM Florian Weimer via Gcc > wrote: > > > Are these code fragments valid C89 code? > > > > int i1 = 1; > > char *p1 = i; > > > > char c; > > char *p2 = &c; > > int i2 = p2; > > > > Or can we generate errors for them even with -std=gnu89? > > > > (It will still be possible to override this with -fpermissive or > > -Wno-int-conversion.) > > > > Given that C89 code is unlikely to be actively maintained, I think we > should be permissive by default in that mode. People compiling with an old > -std flag are presumably doing it to keep old code compiling, and it seems > appropriate to respect that. Yeah, complete agreement here. > I'm also (though less strongly) inclined to be permissive in C99 mode, and > only introduce the new strictness by default for C11/C17 modes. Especially when the default is -std=gnu17 that can be an option as well. There might be some code in the wild compiled with -std=gnu99 or -std=c99 just because it wanted to use C99 features back 15-20 years ago and hasn't been adjusted since then, but it might be better to adjust that if needed and keep using those flags only when they are needed because the code isn't C11/C17/C2X ready. Jakub