[Bug c/124576] multiple evaluation of typeof arguments

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 1 20:20:51 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124576

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <uecker@gcc.gnu.org>:

https://gcc.gnu.org/g:9aaedeaced055efe5041004e0643f4f3127c6ce9

commit r17-264-g9aaedeaced055efe5041004e0643f4f3127c6ce9
Author: Martin Uecker <uecker@tugraz.at>
Date:   Sun Apr 26 18:28:16 2026 +0200

    c: argument expressions may be evaluated too often by typeof [PR124576]

    When there are multiple declarators in a declaration and the type
    is specified via typeof, an expression inside the argument of
    typeof may be evaluated multiple times.  Fix this by adding a
    save expression.

            PR c/124576

    gcc/c/ChangeLog:
            * c-decl.cc (declspecs_add_type): Add save_expr.

    gcc/testsuite/ChangeLog:
            * gcc.dg/pr124576.c: New test.


More information about the Gcc-bugs mailing list