From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id 932A53858403 for ; Sat, 3 Feb 2024 13:28:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 932A53858403 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 932A53858403 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::132 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706966912; cv=none; b=jmjqXjqKXeIXVk+0v5e/A5f9hbsUh1mayf/DZr2WW5/knH5b6SkekFVTTokCPytJIBi7XzFMO9TfrQeFHaEfdUfgpZV5C+DqubNLNyP1cZePRTxjPk6To5PeoYjXtgeMdlsGYrCY606lSTHuLYuzo12iAaKdy8MiJwHVdl64IFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706966912; c=relaxed/simple; bh=TOG6x670IFZApc4BKqmo+P5R6aKM1nC/w1A9xor/BZ4=; h=DKIM-Signature:From:Mime-Version:Subject:Date:Message-Id:To; b=hWDkIi0I4Fm3q5QtNxg+1nwSTWSeMSsUhS4KNb5zxPduW4p6DZ1sZ5eM6NZI9+ZvOCxcEgKiwLNn5XC+bucOepD04oSUwvUvjf6gMFXb4Ct0hGlz4tCoaZL9OSZ5oGoDNek8lFDEi9C+ppdBsMI47tRQPzgVOvZ16AVrpsLvDaY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-51124d43943so4781495e87.2 for ; Sat, 03 Feb 2024 05:28:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706966906; x=1707571706; darn=gcc.gnu.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=OH9gejr8MKwmbGjTaW9ALmPJSaNErDUwX9KriV4kylk=; b=gACwoiPskvY28Fjr8uZJSDZUVErRLL5/CqIdpCm917BBTf+JmggVH3lUfcRW17kMuP Enor8HhpU47S+iqPUcV2TC+udbB0ciQDmFV+vLP2KH4RDIXGj5ZD2eAeQbNuJxTfoZ45 nyLOE+i51DhhpsfT4osK9o5gIfAs6fweoqaH8B0YO9jgEo6bvddjoJRgwbCufSVFfWNT SIypFXQLMnNps6jmin97DAiCzvPEE+yZCHG4Kk/7YXvnV0WAFMD6oU/QczP05wX8ebd5 GqKzlBIqXJH14G1L/OCsQJd/0tG/Ho6sL/FfDZyxvNzLcRpF62rMAsgZyJp69+F4kCuv lAjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706966906; x=1707571706; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OH9gejr8MKwmbGjTaW9ALmPJSaNErDUwX9KriV4kylk=; b=mci3Ce1F9CFl9hUiI05JovM2pGNkYzi7yN7VnZoEmFBr42S/9ubA67sMLp90udWe6K inZLTNPFYWkBDqJrIa2vJGDV88hAL1A0UGXQsbg9EmQj0VjVntomFKjUQdCK8i4n14QD AD/H+zL4wkCgjTKW2Nr2n5i+PmYsyMkjTKKW8yS9mmB04N09I0vJ+vXjvqjqNTqISzuC 8MNWmqrDTICH3HqzDH8cCHVeI3f7osnSqKH0sY8H7/OxLy28bkDXM2uysR9mpFI++iDw ayFhP11pq2PENw2mOUEGYYMNfnm8m71pSwx/437Xg0ex7LsdK+8Io6POQNyWirOXumj3 sZZg== X-Gm-Message-State: AOJu0YzNQzmqfM/C38ZfhGA83jk972o2/W82j745yZuCDfbaJKSEe62o gFyY9OqC/Pc1AYLfkVOBvVNkNWKJyKzrT6eBZQmhRED85YBZ8dQqyJ8x+pSi X-Google-Smtp-Source: AGHT+IGOYuG78uGKnEv74R2Vd3STy4kzG5wreVxF1+yNDpWcRyO5r7iVGh3tdwA2xOePHCjryW1xbA== X-Received: by 2002:a05:651c:205a:b0:2d0:6364:fd73 with SMTP id t26-20020a05651c205a00b002d06364fd73mr2913044ljo.33.1706966905623; Sat, 03 Feb 2024 05:28:25 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWzaXjx7tvH3xsfz3Ytn6jBi7Be/IsujJBwvG6j4mg9HrIdKroDdxNKSjvWjbNM/JUt4EVarYzlnLjRhhg7tBjWiIZR45hPhA== Received: from smtpclient.apple (dynamic-095-118-110-069.95.118.pool.telefonica.de. [95.118.110.69]) by smtp.gmail.com with ESMTPSA id v23-20020aa7d657000000b0056020849adfsm497156edr.26.2024.02.03.05.28.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 03 Feb 2024 05:28:25 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] ggc-common: Fix save PCH assertion Date: Sat, 3 Feb 2024 14:28:14 +0100 Message-Id: <5C80FDF3-7774-4DFF-BCB1-C1286EEA6B98@gmail.com> References: Cc: Richard Biener , gcc-patches@gcc.gnu.org In-Reply-To: To: Jakub Jelinek X-Mailer: iPhone Mail (21D50) X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,WEIRD_PORT 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: > Am 03.02.2024 um 09:36 schrieb Jakub Jelinek : >=20 > =EF=BB=BFHi! >=20 > We are getting a gnuradio PCH ICE > /usr/include/pybind11/stl.h:447:1: internal compiler error: in gt_pch_save= , at ggc-common.cc:693 > 0x1304e7d gt_pch_save(_IO_FILE*) > ../../gcc/ggc-common.cc:693 > 0x12a45fb c_common_write_pch() > ../../gcc/c-family/c-pch.cc:175 > 0x18ad711 c_parse_final_cleanups() > ../../gcc/cp/decl2.cc:5062 > 0x213988b c_common_parse_file() > ../../gcc/c-family/c-opts.cc:1319 > (unfortunately it isn't reproduceable always, but often needs > up to 100 attempts, isn't reproduceable in a cross etc.). > The bug is in the assertion I've added in gt_pch_save when adding > relocation support for the PCH files in case they happen not to be > mmapped at the selected address. > addr is a relocated address which points to a location in the PCH > blob (starting at mmi.preferred_base, with mmi.size bytes) which contains > a pointer that needs to be relocated. So the assertion is meant to > verify the address is within the PCH blob, obviously it needs to be > equal or above mmi.preferred_base, but I got the other comparison wrong > and when one is very unlucky and the last sizeof (void *) bytes of the > blob happen to be a pointer which needs to be relocated, such as on the > s390x host addr 0x8008a04ff8, mmi.preferred_base 0x8000000000 and > mmi.size 0x8a05000, addr + sizeof (void *) is equal to mmi.preferred_base += > mmi.size and that is still fine, both addresses are end of something. >=20 > Bootstrapped/regtested on x86_64-linux and i686-linux, plus tested on s390= x > on the testcase which was ICEing in 1-100 iterations and there it survived= > 7750 attempts without ICE (forgot to stop it earlier), ok for trunk? >=20 Ok Richard=20 > 2024-02-03 Jakub Jelinek >=20 > * ggc-common.cc (gt_pch_save): Allow addr to be equal to > mmi.preferred_base + mmi.size - sizeof (void *). >=20 > --- gcc/ggc-common.cc.jj 2024-01-03 11:51:39.397622018 +0100 > +++ gcc/ggc-common.cc 2024-02-02 17:33:13.106727473 +0100 > @@ -692,7 +692,7 @@ gt_pch_save (FILE *f) > { > gcc_assert ((uintptr_t) addr >=3D (uintptr_t) mmi.preferred_base > && ((uintptr_t) addr + sizeof (void *) > - < (uintptr_t) mmi.preferred_base + mmi.size)); > + <=3D (uintptr_t) mmi.preferred_base + mmi.size)); > if (addr =3D=3D last_addr) > continue; > if (last_addr =3D=3D NULL) >=20 > Jakub >=20