public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/106129] New: [12/13 Regression] LTO option merging broken
@ 2022-06-28 22:42 jsm28 at gcc dot gnu.org
  2022-06-29  9:51 ` [Bug lto/106129] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2022-06-28 22:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106129
           Summary: [12/13 Regression] LTO option merging broken
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jsm28 at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

The LTO merging of options from different input files was broken by:

commit 227a2ecf663d69972b851f51f1934d18927b62cd
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Mar 12 11:53:47 2021 +0100

    lto-wrapper: Use vec<cl_decoded_option> data type.

Previously, find_and_merge_options would merge options it read into those in
*opts. After this commit, options in *opts on entry to find_and_merge_options
are ignored; the only merging that takes place is between multiple sets of
options in the same input file that are read in the same call to this function
(not sure how that case can occur at all). The effects include, for example,
that if some objects are built with PIC enabled and others with it disabled,
and the last LTO object processed has PIC enabled, the choice of PIC for the
last object will result in the whole program being built as PIC, when the
merging logic is intended to ensure that a mixture of PIC and non-PIC objects
results in the whole program being built as non-PIC.

I'm testing a patch for this bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/106129] [12/13 Regression] LTO option merging broken
  2022-06-28 22:42 [Bug lto/106129] New: [12/13 Regression] LTO option merging broken jsm28 at gcc dot gnu.org
@ 2022-06-29  9:51 ` rguenth at gcc dot gnu.org
  2022-06-30 16:42 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-29  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
   Target Milestone|---                         |12.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/106129] [12/13 Regression] LTO option merging broken
  2022-06-28 22:42 [Bug lto/106129] New: [12/13 Regression] LTO option merging broken jsm28 at gcc dot gnu.org
  2022-06-29  9:51 ` [Bug lto/106129] " rguenth at gcc dot gnu.org
@ 2022-06-30 16:42 ` cvs-commit at gcc dot gnu.org
  2022-06-30 16:43 ` [Bug lto/106129] [12 " jsm28 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-30 16:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joseph Myers <jsm28@gcc.gnu.org>:

https://gcc.gnu.org/g:8a8ee37a3325f1009034245676ef4e482c0444a2

commit r13-1368-g8a8ee37a3325f1009034245676ef4e482c0444a2
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Jun 30 16:41:40 2022 +0000

    lto: Fix option merging [PR106129]

    The LTO merging of options from different input files was broken by:

    commit 227a2ecf663d69972b851f51f1934d18927b62cd
    Author: Martin Liska <mliska@suse.cz>
    Date:   Fri Mar 12 11:53:47 2021 +0100

        lto-wrapper: Use vec<cl_decoded_option> data type.

    Previously, find_and_merge_options would merge options it read into
    those in *opts. After this commit, options in *opts on entry to
    find_and_merge_options are ignored; the only merging that takes place
    is between multiple sets of options in the same input file that are
    read in the same call to this function (not sure how that case can
    occur at all). The effects include, for example, that if some objects
    are built with PIC enabled and others with it disabled, and the last
    LTO object processed has PIC enabled, the choice of PIC for the last
    object will result in the whole program being built as PIC, when the
    merging logic is intended to ensure that a mixture of PIC and non-PIC
    objects results in the whole program being built as non-PIC.

    Fix this with an extra argument to find_and_merge_options to determine
    whether merging should take place.  This shows up a second issue with
    that commit (which I think wasn't actually intended to change code
    semantics at all): once merging is enabled again, the check for
    -Xassembler options became an infinite loop in the case where both
    inputs had -Xassembler options, with the same first option, so fix
    that loop to restore the previous semantics.

    Note that I'm not sure how LTO option merging might be tested in the
    testsuite (clearly there wasn't sufficient, if any, coverage to detect
    these bugs).

    Bootstrapped with no regressions for x86_64-pc-linux-gnu.

            PR lto/106129
            * lto-wrapper.cc (find_option): Add argument start.
            (merge_and_complain): Loop over existing_opt_index and
            existing_opt2_index for Xassembler check.  Update calls to
            find_option.
            (find_and_merge_options): Add argument first to determine whether
            to merge options with those passed in *opts.
            (run_gcc): Update calls to find_and_merge_options.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/106129] [12 Regression] LTO option merging broken
  2022-06-28 22:42 [Bug lto/106129] New: [12/13 Regression] LTO option merging broken jsm28 at gcc dot gnu.org
  2022-06-29  9:51 ` [Bug lto/106129] " rguenth at gcc dot gnu.org
  2022-06-30 16:42 ` cvs-commit at gcc dot gnu.org
@ 2022-06-30 16:43 ` jsm28 at gcc dot gnu.org
  2022-07-27  9:24 ` cvs-commit at gcc dot gnu.org
  2022-07-27  9:25 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2022-06-30 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-06-30
     Ever confirmed|0                           |1
            Summary|[12/13 Regression] LTO      |[12 Regression] LTO option
                   |option merging broken       |merging broken
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Fixed so far for GCC 13.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/106129] [12 Regression] LTO option merging broken
  2022-06-28 22:42 [Bug lto/106129] New: [12/13 Regression] LTO option merging broken jsm28 at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-06-30 16:43 ` [Bug lto/106129] [12 " jsm28 at gcc dot gnu.org
@ 2022-07-27  9:24 ` cvs-commit at gcc dot gnu.org
  2022-07-27  9:25 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-27  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:d2892faac6d760ebc47f8f6ebee51e5cf6255cc8

commit r12-8628-gd2892faac6d760ebc47f8f6ebee51e5cf6255cc8
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Jun 30 16:41:40 2022 +0000

    lto: Fix option merging [PR106129]

    The LTO merging of options from different input files was broken by:

    commit 227a2ecf663d69972b851f51f1934d18927b62cd
    Author: Martin Liska <mliska@suse.cz>
    Date:   Fri Mar 12 11:53:47 2021 +0100

        lto-wrapper: Use vec<cl_decoded_option> data type.

    Previously, find_and_merge_options would merge options it read into
    those in *opts. After this commit, options in *opts on entry to
    find_and_merge_options are ignored; the only merging that takes place
    is between multiple sets of options in the same input file that are
    read in the same call to this function (not sure how that case can
    occur at all). The effects include, for example, that if some objects
    are built with PIC enabled and others with it disabled, and the last
    LTO object processed has PIC enabled, the choice of PIC for the last
    object will result in the whole program being built as PIC, when the
    merging logic is intended to ensure that a mixture of PIC and non-PIC
    objects results in the whole program being built as non-PIC.

    Fix this with an extra argument to find_and_merge_options to determine
    whether merging should take place.  This shows up a second issue with
    that commit (which I think wasn't actually intended to change code
    semantics at all): once merging is enabled again, the check for
    -Xassembler options became an infinite loop in the case where both
    inputs had -Xassembler options, with the same first option, so fix
    that loop to restore the previous semantics.

    Note that I'm not sure how LTO option merging might be tested in the
    testsuite (clearly there wasn't sufficient, if any, coverage to detect
    these bugs).

    Bootstrapped with no regressions for x86_64-pc-linux-gnu.

            PR lto/106129
            * lto-wrapper.cc (find_option): Add argument start.
            (merge_and_complain): Loop over existing_opt_index and
            existing_opt2_index for Xassembler check.  Update calls to
            find_option.
            (find_and_merge_options): Add argument first to determine whether
            to merge options with those passed in *opts.
            (run_gcc): Update calls to find_and_merge_options.

    (cherry picked from commit 8a8ee37a3325f1009034245676ef4e482c0444a2)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/106129] [12 Regression] LTO option merging broken
  2022-06-28 22:42 [Bug lto/106129] New: [12/13 Regression] LTO option merging broken jsm28 at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-07-27  9:24 ` cvs-commit at gcc dot gnu.org
@ 2022-07-27  9:25 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-27  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.1.1, 13.0
             Status|NEW                         |RESOLVED
      Known to fail|                            |12.1.0
         Resolution|---                         |FIXED

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-27  9:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 22:42 [Bug lto/106129] New: [12/13 Regression] LTO option merging broken jsm28 at gcc dot gnu.org
2022-06-29  9:51 ` [Bug lto/106129] " rguenth at gcc dot gnu.org
2022-06-30 16:42 ` cvs-commit at gcc dot gnu.org
2022-06-30 16:43 ` [Bug lto/106129] [12 " jsm28 at gcc dot gnu.org
2022-07-27  9:24 ` cvs-commit at gcc dot gnu.org
2022-07-27  9:25 ` rguenth at gcc dot gnu.org

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).