public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112952] New: avr: attribute address not working with -fdata-sections -fno-common
@ 2023-12-11  8:30 gjl at gcc dot gnu.org
  2023-12-11  8:40 ` [Bug target/112952] " gjl at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-12-11  8:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112952
           Summary: avr: attribute address not working with
                    -fdata-sections -fno-common
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

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

* [Bug target/112952] avr: attribute address not working with -fdata-sections -fno-common
  2023-12-11  8:30 [Bug target/112952] New: avr: attribute address not working with -fdata-sections -fno-common gjl at gcc dot gnu.org
@ 2023-12-11  8:40 ` gjl at gcc dot gnu.org
  2024-01-08 11:30 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-12-11  8:40 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |avr
      Known to fail|                            |13.2.0, 8.5.0
           Keywords|                            |wrong-code

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Compile the follwing test with avr-gcc ... -fdata-sections -fno-common -S

__attribute__((__address__(0)))
char __flmap;

The generates assembly reads:

.global __flmap
        .section        .bss.__flmap,"aw",@nobits
        .type   __flmap, @object
        .size   __flmap, 1
__flmap:
        .zero   1

but the expected code is:

.globl  __flmap
__flmap = 0

This problem becomes more pronounced as v10 switched from -fcommon to
-fno-common as the default.

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

* [Bug target/112952] avr: attribute address not working with -fdata-sections -fno-common
  2023-12-11  8:30 [Bug target/112952] New: avr: attribute address not working with -fdata-sections -fno-common gjl at gcc dot gnu.org
  2023-12-11  8:40 ` [Bug target/112952] " gjl at gcc dot gnu.org
@ 2024-01-08 11:30 ` cvs-commit at gcc dot gnu.org
  2024-01-08 11:45 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-08 11:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <gjl@gcc.gnu.org>:

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

commit r14-6999-gc131b1d5da412b9b0f0681fc5704cdc9b7cafb04
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Mon Jan 8 12:20:45 2024 +0100

    AVR: PR target/112952: Fix attribute "address", "io" and "io_low"

    so they work with all combinations of -f[no-]data-sections -f[no-]common.
    The patch also improves some diagnostics and adds additional checks, for
    example these attributes must only be applied to variables in static
storage.

    gcc/
            PR target/112952
            * config/avr/avr.cc (avr_handle_addr_attribute): Also print valid
            range when diagnosing attribute "io" and "io_low" are out of range.
            (avr_eval_addr_attrib): Don't ICE on empty address at that place.
            (avr_insert_attributes): Reject if attribute "address", "io" or
"io_low"
            in contexts other than static storage.
            (avr_asm_output_aligned_decl_common): Move output of decls with
            attribute "address", "io", and "io_low" to...
            (avr_output_addr_attrib): ...this new function.
            (avr_asm_asm_output_aligned_bss): Remove output for decls with
            attribute "address", "io", and "io_low".
            (avr_encode_section_info): Rectify handling of decls with attribute
            "address", "io", and "io_low".

    gcc/testsuite/
            PR target/112952
            * gcc.target/avr/attribute-io.h: New file.
            * gcc.target/avr/pr112952-0.c: New test.
            * gcc.target/avr/pr112952-1.c: New test.
            * gcc.target/avr/pr112952-2.c: New test.
            * gcc.target/avr/pr112952-3.c: New test.

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

* [Bug target/112952] avr: attribute address not working with -fdata-sections -fno-common
  2023-12-11  8:30 [Bug target/112952] New: avr: attribute address not working with -fdata-sections -fno-common gjl at gcc dot gnu.org
  2023-12-11  8:40 ` [Bug target/112952] " gjl at gcc dot gnu.org
  2024-01-08 11:30 ` cvs-commit at gcc dot gnu.org
@ 2024-01-08 11:45 ` cvs-commit at gcc dot gnu.org
  2024-01-08 12:14 ` gjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-08 11:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Georg-Johann Lay
<gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:5d0d592c486c31bd9c26af0d1f0a7b6a3d68c22b

commit r13-8197-g5d0d592c486c31bd9c26af0d1f0a7b6a3d68c22b
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Mon Jan 8 12:20:45 2024 +0100

    AVR: PR target/112952: Fix attribute "address", "io" and "io_low"

    so they work with all combinations of -f[no-]data-sections -f[no-]common.
    The patch also improves some diagnostics and adds additional checks, for
    example these attributes must only be applied to variables in static
storage.

    gcc/
            PR target/112952
            * config/avr/avr.cc (avr_handle_addr_attribute): Also print valid
            range when diagnosing attribute "io" and "io_low" are out of range.
            (avr_eval_addr_attrib): Don't ICE on empty address at that place.
            (avr_insert_attributes): Reject if attribute "address", "io" or
"io_low"
            in contexts other than static storage.
            (avr_asm_output_aligned_decl_common): Move output of decls with
            attribute "address", "io", and "io_low" to...
            (avr_output_addr_attrib): ...this new function.
            (avr_asm_asm_output_aligned_bss): Remove output for decls with
            attribute "address", "io", and "io_low".
            (avr_encode_section_info): Rectify handling of decls with attribute
            "address", "io", and "io_low".

    gcc/testsuite/
            PR target/112952
            * gcc.target/avr/attribute-io.h: New file.
            * gcc.target/avr/pr112952-0.c: New test.
            * gcc.target/avr/pr112952-1.c: New test.
            * gcc.target/avr/pr112952-2.c: New test.
            * gcc.target/avr/pr112952-3.c: New test.

    (cherry picked from commit c131b1d5da412b9b0f0681fc5704cdc9b7cafb04)

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

* [Bug target/112952] avr: attribute address not working with -fdata-sections -fno-common
  2023-12-11  8:30 [Bug target/112952] New: avr: attribute address not working with -fdata-sections -fno-common gjl at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-01-08 11:45 ` cvs-commit at gcc dot gnu.org
@ 2024-01-08 12:14 ` gjl at gcc dot gnu.org
  2024-01-08 13:13 ` cvs-commit at gcc dot gnu.org
  2024-01-08 13:15 ` gjl at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-08 12:14 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |13.3

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Fixed in v13.3+

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

* [Bug target/112952] avr: attribute address not working with -fdata-sections -fno-common
  2023-12-11  8:30 [Bug target/112952] New: avr: attribute address not working with -fdata-sections -fno-common gjl at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-01-08 12:14 ` gjl at gcc dot gnu.org
@ 2024-01-08 13:13 ` cvs-commit at gcc dot gnu.org
  2024-01-08 13:15 ` gjl at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-08 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Georg-Johann Lay
<gjl@gcc.gnu.org>:

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

commit r12-10085-gebae82f35033be6e022dce65cea0148ddf9df025
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Mon Jan 8 12:20:45 2024 +0100

    AVR: PR target/112952: Fix attribute "address", "io" and "io_low"

    so they work with all combinations of -f[no-]data-sections -f[no-]common.
    The patch also improves some diagnostics and adds additional checks, for
    example these attributes must only be applied to variables in static
storage.

    gcc/
            PR target/112952
            * config/avr/avr.cc (avr_handle_addr_attribute): Also print valid
            range when diagnosing attribute "io" and "io_low" are out of range.
            (avr_eval_addr_attrib): Don't ICE on empty address at that place.
            (avr_insert_attributes): Reject if attribute "address", "io" or
"io_low"
            in contexts other than static storage.
            (avr_asm_output_aligned_decl_common): Move output of decls with
            attribute "address", "io", and "io_low" to...
            (avr_output_addr_attrib): ...this new function.
            (avr_asm_asm_output_aligned_bss): Remove output for decls with
            attribute "address", "io", and "io_low".
            (avr_encode_section_info): Rectify handling of decls with attribute
            "address", "io", and "io_low".

    gcc/testsuite/
            PR target/112952
            * gcc.target/avr/attribute-io.h: New file.
            * gcc.target/avr/pr112952-0.c: New test.
            * gcc.target/avr/pr112952-1.c: New test.
            * gcc.target/avr/pr112952-2.c: New test.
            * gcc.target/avr/pr112952-3.c: New test.

    (cherry picked from commit c131b1d5da412b9b0f0681fc5704cdc9b7cafb04)

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

* [Bug target/112952] avr: attribute address not working with -fdata-sections -fno-common
  2023-12-11  8:30 [Bug target/112952] New: avr: attribute address not working with -fdata-sections -fno-common gjl at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-01-08 13:13 ` cvs-commit at gcc dot gnu.org
@ 2024-01-08 13:15 ` gjl at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-08 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Also fixed on the v12 branch for v12.4+

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

end of thread, other threads:[~2024-01-08 13:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11  8:30 [Bug target/112952] New: avr: attribute address not working with -fdata-sections -fno-common gjl at gcc dot gnu.org
2023-12-11  8:40 ` [Bug target/112952] " gjl at gcc dot gnu.org
2024-01-08 11:30 ` cvs-commit at gcc dot gnu.org
2024-01-08 11:45 ` cvs-commit at gcc dot gnu.org
2024-01-08 12:14 ` gjl at gcc dot gnu.org
2024-01-08 13:13 ` cvs-commit at gcc dot gnu.org
2024-01-08 13:15 ` gjl 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).