From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ADB613861001; Wed, 24 Apr 2024 03:05:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ADB613861001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713927903; bh=khtIKH/e3pbjTwnv1L6ONQnDLC18HohnfW4/qIHwCsg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FG7Ws1DdGIYkESypG/lrigJLjI/t37xlAk1ykF29GXszhr4EcA00IVC6dk01oNJgh eBo2dgJbFMgLpA3UI5IZeYIjFnqKTYfLXYfJFScNSenSrll3SCMTK0DTB+J06CRm1j oMk/AHPz2Ni80u2rJP18bT4z48cY2BCT9bLbd9yw= From: "jvdelisle at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/98426] find_symbol in module.c traverses O(N) part of a search tree Date: Wed, 24 Apr 2024 03:05:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: jvdelisle at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98426 --- Comment #8 from Jerry DeLisle --- Martin or Matt, Can you test the following variation to see if you get better results. return st; } retval =3D NULL; if (c <=3D 0) retval =3D find_symbol (st->left, name, module, generic); if (c > 0 && retval =3D=3D NULL) retval =3D find_symbol (st->right, name, module, generic); if (c > 0 && retval =3D=3D NULL) retval =3D find_symbol (st->left, name, module, generic); if (c <=3D 0 && retval =3D=3D NULL) retval =3D find_symbol (st->right, name, module, generic); return retval; This does pass regression testing but I do not think it guarantees better results. Apparently the value of c does not guarantee a find going left or right.=