From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A3B13857352; Fri, 6 Oct 2023 16:34:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A3B13857352 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696610061; bh=ODogVXqtzHi8IbR3QzvNyq/zXruH75ANLcP8etQbzWM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sDjXzBGDfJ1Ohn6f7QS9dUR1qHVbUnmJjgpkr9oEQ+6JAox3RHPShdO/R+AXngBRq Rql7BCawcoRmM1VDrfVX7oLrg9uqmCHAizbN3Bk5qmuCRtibrl4kfwLWYPK15CuJgE TN5Uf3A8lwL9xlsxf8srFBtjsay4ngyzmOr0749g= From: "lukas.graetz@tu-darmstadt.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/111643] __attribute__((flatten)) with -O1 runs out of memory (killed cc1) Date: Fri, 06 Oct 2023 16:34:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: documentation X-Bugzilla-Severity: normal X-Bugzilla-Who: lukas.graetz@tu-darmstadt.de X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WONTFIX 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=3D111643 --- Comment #9 from Lukas Gr=C3=A4tz --- Thanks for everything, it seemed to be a misunderstanding from my side anyw= ay and the documentation fix should help others. I am sorry for being silent, I was sick for a few days. As for my original problem, I am thinking of opening a new report, because I realized there co= uld be another solution without flatten. To explain a bit more, we have bar_original() and bar_new(), the latter should behave identical to the for= mer except one additional statement, the "instrumentation". Since the instrumentation can be done in two assembler instructions only, the overhea= d of bar_new() calling bar_original() is not negligible. int bar_original (int x) { /* CODE */ } unsigned int trace_buffer[512]; uint8_t trace_pos; #define FUNCTION_NUMBER_bar 0x686 int bar_new (int x) { trace_buffer[trace_pos++] =3D 0x686; // instrumentation return bar_original(x); } My idea: Do not touch the stack inside bar_new() and replace the call in bar_new() with a jump or better a fall-through to bar_original(). This is possible, because both functions have the same signature. It could save aro= und 4 instructions and some stack memory. I have a lot of such functions after = my instrumentation step. I also wondered whether int bar_alias (void) { return bar_original(); } could be a portable alternative to attribute alias. Except that current GCC does not translate it that way.=