From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: scratch/igc warning Date: Wed, 26 Jun 2024 16:39:24 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36496"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 26 16:40:11 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sMToh-0009H0-AA for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jun 2024 16:40:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMTo3-0002NP-Gx; Wed, 26 Jun 2024 10:39:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMTo1-0002Ml-TY for emacs-devel@gnu.org; Wed, 26 Jun 2024 10:39:30 -0400 Original-Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMTo0-0002pU-50; Wed, 26 Jun 2024 10:39:29 -0400 Original-Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2ec5779b423so46574351fa.0; Wed, 26 Jun 2024 07:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719412766; x=1720017566; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ITVaboJ4/4eCVMrbr0wm+Gx/0pTjm8N0cxlBenj7iu8=; b=Rde2YQA55Egf//wmAan3U7IHIBFR9ZW11lnTIotQD+qUJE8ZJ9wjTsGLzy9BGxZq2F IPdg/qLpqt7gCFn/xz7U3ZK7kQFT9EFChw5PfM5tpemy+w67Z6hnzKyv7F+xA+wwrcwS ahHUxAsChoaixm265bvErg0HxvjI1UkFvK96GSJgaNlNiZxJXfgEGhw7lyztd0F+BZfI YHpct5l2N8WFwOZV8iogrWI6GDJuDulS7YOh4t07ZZMPieV1/FFz/NKje+Lz4+6IVs9a +zp7JOM5eMblsLAvuEgcTfb2HM72RUBROAMVoTGZJoK3iLu8+E8KmS/yaPEGKA/Tx034 qWbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719412766; x=1720017566; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ITVaboJ4/4eCVMrbr0wm+Gx/0pTjm8N0cxlBenj7iu8=; b=uLHLZU0BjjoIPF9G1pqbG5E6WKFXndsXcSTFLJ5xEqImJlvzeMAgIUIJLIuUHEFdpT tpk1eHUCaRVISO0jM9XYfVhI/jgAYvn+NfPmmZaujphXqEx8XqdhfRnexyVj/PlYVCdC RNb/+RZaX5N46p5TX7yzSNX/FxnNY41HIYwBOOCurgAWKhe69VErh4XQ8z79sYV6knEA gwNq5qxXvDETPvQ+jO+vor/JU9xUF6O1oYBUKlmt6yaeLGVewkvoLzQyVI70BFMRPgpg JKPM8nvj60dgTAEyYg+80khEK9f43Z2ZZLIiDiLBr0HHvYVTEtmxbSeOjBiaqx18E6fN 8yGA== X-Gm-Message-State: AOJu0Yy+GqZttuI1FD7q04Fe3knVTJ9NIb/uu44qzoxTzU4WGgCt/RG9 OfYsujQQpYhhxyjuMhmg+y5rIcniRit/srEjrA76kaGcNwVL8LsukWlFcQ== X-Google-Smtp-Source: AGHT+IFWadOvvCbWAFQTtu8JfG/jPU8+aVFAArOQnb88vJLEuBP7YkjvBRNhNGSqE2lL3cZw181mIw== X-Received: by 2002:a2e:9e59:0:b0:2ec:5518:9550 with SMTP id 38308e7fff4ca-2ec5930fdbcmr82120421fa.10.1719412765245; Wed, 26 Jun 2024 07:39:25 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e360b7.dip0.t-ipconnect.de. [217.227.96.183]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3666dc46d50sm15602902f8f.67.2024.06.26.07.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 07:39:24 -0700 (PDT) In-Reply-To: (Andrea Corallo's message of "Wed, 26 Jun 2024 10:08:53 -0400") Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=gerd.moellmann@gmail.com; helo=mail-lj1-x233.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:320700 Archived-At: Andrea Corallo writes: > Hi, > > GCC 12.3 is giving me this warning building scratch/igc: > > =3D=3D=3D=3D=3D=3D=3D=3D > CC xfaces.o > In file included from /usr/include/string.h:535, > from ../lib/string.h:41, > from lisp.h:29, > from xfaces.c:226: > In function =E2=80=98memset=E2=80=99, > inlined from =E2=80=98make_realized_face=E2=80=99 at xfaces.c:4581:3, > inlined from =E2=80=98realize_gui_face=E2=80=99 at xfaces.c:6214:10, > inlined from =E2=80=98realize_face=E2=80=99 at xfaces.c:6124:12: > /usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:10: warning: =E2= =80=98__builtin_memset=E2=80=99 offset [164, 303] from the object at =E2=80= =98face=E2=80=99 is out of the bounds of referenced subobject =E2=80=98id= =E2=80=99 with type =E2=80=98int=E2=80=99 at offset 160 [-Warray-bounds] > 59 | return __builtin___memset_chk (__dest, __ch, __len, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 60 | __glibc_objsize0 (__dest)); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~ > In file included from termhooks.h:27, > from frame.h:22, > from xfaces.c:229: > dispextern.h: In function =E2=80=98realize_face=E2=80=99: > dispextern.h:1730:7: note: subobject =E2=80=98id=E2=80=99 declared here > 1730 | int id; > | ^~ > In function =E2=80=98memset=E2=80=99, > inlined from =E2=80=98make_realized_face=E2=80=99 at xfaces.c:4581:3, > inlined from =E2=80=98realize_tty_face=E2=80=99 at xfaces.c:6641:10, > inlined from =E2=80=98realize_face=E2=80=99 at xfaces.c:6126:12: > /usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:10: warning: =E2= =80=98__builtin_memset=E2=80=99 offset [164, 303] from the object at =E2=80= =98face=E2=80=99 is out of the bounds of referenced subobject =E2=80=98id= =E2=80=99 with type =E2=80=98int=E2=80=99 at offset 160 [-Warray-bounds] > 59 | return __builtin___memset_chk (__dest, __ch, __len, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 60 | __glibc_objsize0 (__dest)); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~ > dispextern.h: In function =E2=80=98realize_face=E2=80=99: > dispextern.h:1730:7: note: subobject =E2=80=98id=E2=80=99 declared here > 1730 | int id; > | ^~ > In function =E2=80=98memset=E2=80=99, > inlined from =E2=80=98make_realized_face=E2=80=99 at xfaces.c:4581:3, > inlined from =E2=80=98realize_face=E2=80=99 at xfaces.c:6130:14: > /usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:10: warning: =E2= =80=98__builtin_memset=E2=80=99 offset [164, 303] from the object at =E2=80= =98face=E2=80=99 is out of the bounds of referenced subobject =E2=80=98id= =E2=80=99 with type =E2=80=98int=E2=80=99 at offset 160 [-Warray-bounds] > 59 | return __builtin___memset_chk (__dest, __ch, __len, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 60 | __glibc_objsize0 (__dest)); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~ > dispextern.h: In function =E2=80=98realize_face=E2=80=99: > dispextern.h:1730:7: note: subobject =E2=80=98id=E2=80=99 declared here > 1730 | int id; > | ^~ > =3D=3D=3D=3D=3D=3D=3D=3D > > ATM don't know if it's a real issue or a false positive so I thought was > worth mentioning. Hm, that's this one, right? static struct face * make_realized_face (Lisp_Object *attr) { enum { off =3D offsetof (struct face, id) }; #ifdef HAVE_MPS struct face *face =3D igc_make_face (); #else struct face *face =3D xmalloc (sizeof *face); #endif memcpy (face->lface, attr, sizeof face->lface); memset (&face->id, 0, sizeof *face - off); face->ascii_face =3D face; return face; } which we can rewrite, for MPS static struct face * make_realized_face (Lisp_Object *attr) { #ifdef HAVE_MPS struct face *face =3D igc_make_face (); memcpy (face->lface, attr, sizeof face->lface); #else enum { off =3D offsetof (struct face, id) }; struct face *face =3D xmalloc (sizeof *face); memcpy (face->lface, attr, sizeof face->lface); memset (&face->id, 0, sizeof *face - off); #endif face->ascii_face =3D face; return face; } because igc returns something zero-initialized anyway. (I'll do that.). But I wonder - does GCC 12 also complain for the non-MPS case?