public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/106563] New: [12/13 Regression] d: undefined reference to pragma(inline) symbol
@ 2022-08-08 19:43 ibuclaw at gdcproject dot org
  2022-08-08 19:45 ` [Bug d/106563] " ibuclaw at gdcproject dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ibuclaw at gdcproject dot org @ 2022-08-08 19:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106563
           Summary: [12/13 Regression] d: undefined reference to
                    pragma(inline) symbol
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

Compiled with `gdc test.d` results in:
/usr/bin/ld: /tmp/ccxf3O8c.o: in function
`stdx.math.nextPow2!(ulong).nextPow2(const(ulong))':
test.d:(.text+0x6d): undefined reference to
`stdx.math.powIntegralImpl!(const(ulong)).powIntegralImpl(const(ulong))'
collect2: error: ld returned 1 exit status

Because the function is pragma(inline), it should receive automatic codegen
during the front-end -> GCC tree lowering pass.

---
module stdx.math;

T nextPow2(T)(const T val)
{
    return powIntegralImpl(val);
}

pragma(inline, true)
T powIntegralImpl(T)(T)
{
    return 1;
}
---
module stdx.regex;
import stdx.uni;

struct CharMatcher
{
    typeof(MultiArray!().length) trie;
}
---
module stdx.uni;

struct MultiArray()
{
    @property length()
    {
        return spaceFor!0();
    }
}

size_t spaceFor(size_t bits)()
{
    import stdx.math;
    return nextPow2(bits);
}
---
module test;
import stdx.math;
import stdx.regex;

void requireSize()(size_t size)
{
    nextPow2(size);
}

void main()
{
    requireSize(0);
}

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

* [Bug d/106563] [12/13 Regression] d: undefined reference to pragma(inline) symbol
  2022-08-08 19:43 [Bug d/106563] New: [12/13 Regression] d: undefined reference to pragma(inline) symbol ibuclaw at gdcproject dot org
@ 2022-08-08 19:45 ` ibuclaw at gdcproject dot org
  2022-08-09  7:39 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ibuclaw at gdcproject dot org @ 2022-08-08 19:45 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Buclaw <ibuclaw at gdcproject dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |12.1.0
      Known to work|                            |11.1.0

--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Well, not really a regression, but it rears its ugly head in gdc-12 because
nextPow2() now gets instantiated in the `test' module, whereas previously it
didn't.

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

* [Bug d/106563] [12/13 Regression] d: undefined reference to pragma(inline) symbol
  2022-08-08 19:43 [Bug d/106563] New: [12/13 Regression] d: undefined reference to pragma(inline) symbol ibuclaw at gdcproject dot org
  2022-08-08 19:45 ` [Bug d/106563] " ibuclaw at gdcproject dot org
@ 2022-08-09  7:39 ` rguenth at gcc dot gnu.org
  2022-08-09 12:41 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-09  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug d/106563] [12/13 Regression] d: undefined reference to pragma(inline) symbol
  2022-08-08 19:43 [Bug d/106563] New: [12/13 Regression] d: undefined reference to pragma(inline) symbol ibuclaw at gdcproject dot org
  2022-08-08 19:45 ` [Bug d/106563] " ibuclaw at gdcproject dot org
  2022-08-09  7:39 ` rguenth at gcc dot gnu.org
@ 2022-08-09 12:41 ` cvs-commit at gcc dot gnu.org
  2022-08-09 12:42 ` cvs-commit at gcc dot gnu.org
  2022-08-09 12:43 ` ibuclaw at gdcproject dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-09 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>:

https://gcc.gnu.org/g:04284176d549ff2565406406a6d53ab4ba8e507d

commit r13-2002-g04284176d549ff2565406406a6d53ab4ba8e507d
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Tue Aug 9 12:48:14 2022 +0200

    d: Fix undefined reference to pragma(inline) symbol (PR106563)

    Functions that are declared `pragma(inline)' should be treated as if
    they are defined in every translation unit they are referenced from,
    regardless of visibility protection.  Ensure they always get
    DECL_ONE_ONLY linkage, and start emitting them into other modules that
    import them.

            PR d/106563

    gcc/d/ChangeLog:

            * decl.cc (DeclVisitor::visit (FuncDeclaration *)): Set semanticRun
            before generating its symbol.
            (function_defined_in_root_p): New function.
            (function_needs_inline_definition_p): New function.
            (maybe_build_decl_tree): New function.
            (get_symbol_decl): Call maybe_build_decl_tree before returning
symbol.
            (start_function): Use function_defined_in_root_p instead of inline
            test for locally defined symbols.
            (set_linkage_for_decl): Check for inline functions before private
or
            protected symbols.

    gcc/testsuite/ChangeLog:

            * gdc.dg/torture/torture.exp (srcdir): New proc.
            * gdc.dg/torture/imports/pr106563math.d: New test.
            * gdc.dg/torture/imports/pr106563regex.d: New test.
            * gdc.dg/torture/imports/pr106563uni.d: New test.
            * gdc.dg/torture/pr106563.d: New test.

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

* [Bug d/106563] [12/13 Regression] d: undefined reference to pragma(inline) symbol
  2022-08-08 19:43 [Bug d/106563] New: [12/13 Regression] d: undefined reference to pragma(inline) symbol ibuclaw at gdcproject dot org
                   ` (2 preceding siblings ...)
  2022-08-09 12:41 ` cvs-commit at gcc dot gnu.org
@ 2022-08-09 12:42 ` cvs-commit at gcc dot gnu.org
  2022-08-09 12:43 ` ibuclaw at gdcproject dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-09 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:79a86a608691621659b3ce3a24a72aeea4054668

commit r12-8673-g79a86a608691621659b3ce3a24a72aeea4054668
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Tue Aug 9 12:48:14 2022 +0200

    d: Fix undefined reference to pragma(inline) symbol (PR106563)

    Functions that are declared `pragma(inline)' should be treated as if
    they are defined in every translation unit they are referenced from,
    regardless of visibility protection.  Ensure they always get
    DECL_ONE_ONLY linkage, and start emitting them into other modules that
    import them.

            PR d/106563

    gcc/d/ChangeLog:

            * decl.cc (DeclVisitor::visit (FuncDeclaration *)): Set semanticRun
            before generating its symbol.
            (function_defined_in_root_p): New function.
            (function_needs_inline_definition_p): New function.
            (maybe_build_decl_tree): New function.
            (get_symbol_decl): Call maybe_build_decl_tree before returning
symbol.
            (start_function): Use function_defined_in_root_p instead of inline
            test for locally defined symbols.
            (set_linkage_for_decl): Check for inline functions before private
or
            protected symbols.

    gcc/testsuite/ChangeLog:

            * gdc.dg/torture/torture.exp (srcdir): New proc.
            * gdc.dg/torture/imports/pr106563math.d: New test.
            * gdc.dg/torture/imports/pr106563regex.d: New test.
            * gdc.dg/torture/imports/pr106563uni.d: New test.
            * gdc.dg/torture/pr106563.d: New test.

    (cherry picked from commit 04284176d549ff2565406406a6d53ab4ba8e507d)

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

* [Bug d/106563] [12/13 Regression] d: undefined reference to pragma(inline) symbol
  2022-08-08 19:43 [Bug d/106563] New: [12/13 Regression] d: undefined reference to pragma(inline) symbol ibuclaw at gdcproject dot org
                   ` (3 preceding siblings ...)
  2022-08-09 12:42 ` cvs-commit at gcc dot gnu.org
@ 2022-08-09 12:43 ` ibuclaw at gdcproject dot org
  4 siblings, 0 replies; 6+ messages in thread
From: ibuclaw at gdcproject dot org @ 2022-08-09 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Buclaw <ibuclaw at gdcproject dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Fix committed.

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

end of thread, other threads:[~2022-08-09 12:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 19:43 [Bug d/106563] New: [12/13 Regression] d: undefined reference to pragma(inline) symbol ibuclaw at gdcproject dot org
2022-08-08 19:45 ` [Bug d/106563] " ibuclaw at gdcproject dot org
2022-08-09  7:39 ` rguenth at gcc dot gnu.org
2022-08-09 12:41 ` cvs-commit at gcc dot gnu.org
2022-08-09 12:42 ` cvs-commit at gcc dot gnu.org
2022-08-09 12:43 ` ibuclaw at gdcproject dot 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).