public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pexu@gcc-bugzilla.mail.kapsi.fi" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug driver/111014] New: do_spec_1 terminates arguments too eagerly when processing spec function Date: Mon, 14 Aug 2023 13:04:22 +0000 [thread overview] Message-ID: <bug-111014-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111014 Bug ID: 111014 Summary: do_spec_1 terminates arguments too eagerly when processing spec function Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: pexu@gcc-bugzilla.mail.kapsi.fi Target Milestone: --- Hi. do_spec_1 always terminates the current argument (via end_going_arg) if processing a spec function. 6881 if (processing_spec_function) 6882 end_going_arg (); If a spec function returns a non-null string it is expanded using do_spec_1. 7043 funcval = eval_spec_function (func, args, soft_matched_part); 7044 if (funcval != NULL && do_spec_1 (funcval, 0, NULL) < 0) However, because processing_spec_function is in this case non-zero, there is always a termination after each nested %-sequence has been processed. Thus, e.g. "%:version-compare(>= 1.0 -version-compare= %%(do_spec))" and "%(do_spec)" behave differently if the expanded %-sequences have any trailing parts: # cat version_compare_string.spec *self_spec: + --version-compare=1.0 %<-version-compare=* *do_spec: -W%{!Werror:no-}error *cc1_options: + %:version-compare(>= 1.0 -version-compare= %%(do_spec)) %(do_spec) # gcc -c -xc -specs=version_compare_string.spec - < /dev/null cc1: error: unrecognized command-line option ‘-Wno-’ [...] In the first case, do_spec is not expanded as "-Wno-error" but as "-Wno-" and "error". I wonder if this termination is really necessary; the same effect can be archieved by simply having a whitespace character to follow the spec function, if concatenation is not to be desired.
reply other threads:[~2023-08-14 13:04 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-111014-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).