* [Patch, AVR]: Fix PR34734
@ 2011-06-20 13:46 Georg-Johann Lay
2011-06-28 12:00 ` Ping #1: " Georg-Johann Lay
0 siblings, 1 reply; 8+ messages in thread
From: Georg-Johann Lay @ 2011-06-20 13:46 UTC (permalink / raw)
To: gcc-patches; +Cc: Denis Chertykov, Eric B. Weddington, Anatoly Sokolov
[-- Attachment #1: Type: text/plain, Size: 507 bytes --]
PR34734 produces annoying, false warnings if __attribute__((progmem))
is used in conjunction with C++. DECL_INITIAL is not yet set up in
avr_handle_progmem_attribute.
Johann
PR target/34734
* config/avr/avr.c (avr_handle_progmem_attribute): Move warning
about uninitialized data attributed 'progmem' from here...
(avr_encode_section_info): ...to this new function.
(TARGET_ENCODE_SECTION_INFO): New define.
(avr_section_type_flags): For data in ".progmem.data", remove
section flag SECTION_WRITE.
[-- Attachment #2: pr34734.diff --]
[-- Type: text/x-patch, Size: 2345 bytes --]
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c (revision 175201)
+++ config/avr/avr.c (working copy)
@@ -109,6 +109,7 @@ static void avr_function_arg_advance (cu
static void avr_help (void);
static bool avr_function_ok_for_sibcall (tree, tree);
static void avr_asm_named_section (const char *name, unsigned int flags, tree decl);
+static void avr_encode_section_info (tree, rtx, int);
/* Allocate registers from r25 to r8 for parameters for function calls. */
#define FIRST_CUM_REG 26
@@ -200,6 +201,8 @@ static const struct attribute_spec avr_a
#undef TARGET_ASM_INIT_SECTIONS
#define TARGET_ASM_INIT_SECTIONS avr_asm_init_sections
+#undef TARGET_ENCODE_SECTION_INFO
+#define TARGET_ENCODE_SECTION_INFO avr_encode_section_info
#undef TARGET_REGISTER_MOVE_COST
#define TARGET_REGISTER_MOVE_COST avr_register_move_cost
@@ -5088,12 +5091,7 @@ avr_handle_progmem_attribute (tree *node
}
else if (TREE_STATIC (*node) || DECL_EXTERNAL (*node))
{
- if (DECL_INITIAL (*node) == NULL_TREE && !DECL_EXTERNAL (*node))
- {
- warning (0, "only initialized variables can be placed into "
- "program memory area");
- *no_add_attrs = true;
- }
+ *no_add_attrs = false;
}
else
{
@@ -5308,10 +5306,35 @@ avr_section_type_flags (tree decl, const
".noinit section");
}
+ if (0 == strncmp (name, ".progmem.data", strlen (".progmem.data")))
+ flags &= ~SECTION_WRITE;
+
return flags;
}
+/* Implement `TARGET_ENCODE_SECTION_INFO'. */
+
+static void
+avr_encode_section_info (tree decl, rtx rtl ATTRIBUTE_UNUSED,
+ int new_decl_p)
+{
+ /* In avr_handle_progmem_attribute, DECL_INITIAL is not yet
+ readily available, see PR34734. So we postpone the warning
+ about uninitialized data in program memory section until here. */
+
+ if (new_decl_p
+ && decl && DECL_P (decl)
+ && NULL_TREE == DECL_INITIAL (decl)
+ && avr_progmem_p (decl, DECL_ATTRIBUTES (decl)))
+ {
+ warning (OPT_Wuninitialized,
+ "uninitialized variable %q+D put into "
+ "program memory area", decl);
+ }
+}
+
+
/* Implement `TARGET_ASM_FILE_START'. */
/* Outputs some appropriate text to go at the start of an assembler
file. */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Ping #1: [Patch, AVR]: Fix PR34734
2011-06-20 13:46 [Patch, AVR]: Fix PR34734 Georg-Johann Lay
@ 2011-06-28 12:00 ` Georg-Johann Lay
2011-06-28 13:58 ` Denis Chertykov
0 siblings, 1 reply; 8+ messages in thread
From: Georg-Johann Lay @ 2011-06-28 12:00 UTC (permalink / raw)
To: gcc-patches; +Cc: Denis Chertykov, Eric B. Weddington, Anatoly Sokolov
http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01462.html
Georg-Johann Lay wrote:
> PR34734 produces annoying, false warnings if __attribute__((progmem))
> is used in conjunction with C++. DECL_INITIAL is not yet set up in
> avr_handle_progmem_attribute.
>
> Johann
>
> PR target/34734
> * config/avr/avr.c (avr_handle_progmem_attribute): Move warning
> about uninitialized data attributed 'progmem' from here...
> (avr_encode_section_info): ...to this new function.
> (TARGET_ENCODE_SECTION_INFO): New define.
> (avr_section_type_flags): For data in ".progmem.data", remove
> section flag SECTION_WRITE.
avr_encode_section_info is good place to emit the warning:
DECL_INITIAL has stabilized for C++, the warning will appear even for
unused variables that will eventually be thrown away, and the warning
appears only once (new_decl_p).
Johann
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Ping #1: [Patch, AVR]: Fix PR34734
2011-06-28 12:00 ` Ping #1: " Georg-Johann Lay
@ 2011-06-28 13:58 ` Denis Chertykov
2011-06-29 8:21 ` Georg-Johann Lay
0 siblings, 1 reply; 8+ messages in thread
From: Denis Chertykov @ 2011-06-28 13:58 UTC (permalink / raw)
To: Georg-Johann Lay; +Cc: gcc-patches, Eric B. Weddington, Anatoly Sokolov
2011/6/28 Georg-Johann Lay <avr@gjlay.de>:
> http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01462.html
>
> Georg-Johann Lay wrote:
>> PR34734 produces annoying, false warnings if __attribute__((progmem))
>> is used in conjunction with C++. DECL_INITIAL is not yet set up in
>> avr_handle_progmem_attribute.
>>
>> Johann
>>
>> PR target/34734
>> * config/avr/avr.c (avr_handle_progmem_attribute): Move warning
>> about uninitialized data attributed 'progmem' from here...
>> (avr_encode_section_info): ...to this new function.
>> (TARGET_ENCODE_SECTION_INFO): New define.
>> (avr_section_type_flags): For data in ".progmem.data", remove
>> section flag SECTION_WRITE.
>
> avr_encode_section_info is good place to emit the warning:
> DECL_INITIAL has stabilized for C++, the warning will appear even for
> unused variables that will eventually be thrown away, and the warning
> appears only once (new_decl_p).
Approved.
Denis.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Ping #1: [Patch, AVR]: Fix PR34734
2011-06-28 13:58 ` Denis Chertykov
@ 2011-06-29 8:21 ` Georg-Johann Lay
2011-06-29 10:42 ` Denis Chertykov
0 siblings, 1 reply; 8+ messages in thread
From: Georg-Johann Lay @ 2011-06-29 8:21 UTC (permalink / raw)
To: Denis Chertykov; +Cc: gcc-patches, Eric B. Weddington, Anatoly Sokolov
Denis Chertykov wrote:
> 2011/6/28 Georg-Johann Lay <avr@gjlay.de>:
>> http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01462.html
>>
>> Georg-Johann Lay wrote:
>>> PR34734 produces annoying, false warnings if __attribute__((progmem))
>>> is used in conjunction with C++. DECL_INITIAL is not yet set up in
>>> avr_handle_progmem_attribute.
>>>
>>> Johann
>>>
>>> PR target/34734
>>> * config/avr/avr.c (avr_handle_progmem_attribute): Move warning
>>> about uninitialized data attributed 'progmem' from here...
>>> (avr_encode_section_info): ...to this new function.
>>> (TARGET_ENCODE_SECTION_INFO): New define.
>>> (avr_section_type_flags): For data in ".progmem.data", remove
>>> section flag SECTION_WRITE.
>> avr_encode_section_info is good place to emit the warning:
>> DECL_INITIAL has stabilized for C++, the warning will appear even for
>> unused variables that will eventually be thrown away, and the warning
>> appears only once (new_decl_p).
>
> Approved.
>
> Denis.
Is this a patch that should be backported?
4.6?
4.5?
It's not fix for "bug or doc" but very annoying, false warning.
Johann
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Ping #1: [Patch, AVR]: Fix PR34734
2011-06-29 8:21 ` Georg-Johann Lay
@ 2011-06-29 10:42 ` Denis Chertykov
2011-06-29 12:11 ` Georg-Johann Lay
0 siblings, 1 reply; 8+ messages in thread
From: Denis Chertykov @ 2011-06-29 10:42 UTC (permalink / raw)
To: Georg-Johann Lay; +Cc: gcc-patches, Eric B. Weddington, Anatoly Sokolov
2011/6/29 Georg-Johann Lay <avr@gjlay.de>:
> Denis Chertykov wrote:
>> 2011/6/28 Georg-Johann Lay <avr@gjlay.de>:
>>> http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01462.html
>>>
>>> Georg-Johann Lay wrote:
>>>> PR34734 produces annoying, false warnings if __attribute__((progmem))
>>>> is used in conjunction with C++. DECL_INITIAL is not yet set up in
>>>> avr_handle_progmem_attribute.
>>>>
>>>> Johann
>>>>
>>>> PR target/34734
>>>> * config/avr/avr.c (avr_handle_progmem_attribute): Move warning
>>>> about uninitialized data attributed 'progmem' from here...
>>>> (avr_encode_section_info): ...to this new function.
>>>> (TARGET_ENCODE_SECTION_INFO): New define.
>>>> (avr_section_type_flags): For data in ".progmem.data", remove
>>>> section flag SECTION_WRITE.
>>> avr_encode_section_info is good place to emit the warning:
>>> DECL_INITIAL has stabilized for C++, the warning will appear even for
>>> unused variables that will eventually be thrown away, and the warning
>>> appears only once (new_decl_p).
>>
>> Approved.
>>
>> Denis.
>
> Is this a patch that should be backported?
> 4.6?
> 4.5?
>
> It's not fix for "bug or doc" but very annoying, false warning.
You can backport it if you want.
I'm usually didn't backport such patches.
Denis.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Ping #1: [Patch, AVR]: Fix PR34734
2011-06-29 10:42 ` Denis Chertykov
@ 2011-06-29 12:11 ` Georg-Johann Lay
2011-06-29 13:45 ` Weddington, Eric
0 siblings, 1 reply; 8+ messages in thread
From: Georg-Johann Lay @ 2011-06-29 12:11 UTC (permalink / raw)
To: Denis Chertykov; +Cc: gcc-patches, Eric B. Weddington, Anatoly Sokolov
Denis Chertykov wrote:
> 2011/6/29 Georg-Johann Lay <avr@gjlay.de>:
>> Denis Chertykov wrote:
>>> 2011/6/28 Georg-Johann Lay <avr@gjlay.de>:
>>>> http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01462.html
>>>>
>>>> Georg-Johann Lay wrote:
>>>>> PR34734 produces annoying, false warnings if __attribute__((progmem))
>>>>> is used in conjunction with C++. DECL_INITIAL is not yet set up in
>>>>> avr_handle_progmem_attribute.
>>>>>
>>>>> Johann
>>>>>
>>>>> PR target/34734
>>>>> * config/avr/avr.c (avr_handle_progmem_attribute): Move warning
>>>>> about uninitialized data attributed 'progmem' from here...
>>>>> (avr_encode_section_info): ...to this new function.
>>>>> (TARGET_ENCODE_SECTION_INFO): New define.
>>>>> (avr_section_type_flags): For data in ".progmem.data", remove
>>>>> section flag SECTION_WRITE.
>>>> avr_encode_section_info is good place to emit the warning:
>>>> DECL_INITIAL has stabilized for C++, the warning will appear even for
>>>> unused variables that will eventually be thrown away, and the warning
>>>> appears only once (new_decl_p).
>>> Approved.
>>>
>>> Denis.
>> Is this a patch that should be backported?
>> 4.6?
>> 4.5?
>>
>> It's not fix for "bug or doc" but very annoying, false warning.
>
> You can backport it if you want.
>
> I'm usually didn't backport such patches.
>
> Denis.
Ok, maybe Eric or Anatoly have some preference for 4.5/4.6.
Applied to 4.7 together with following corrigendum:
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c (revision 175628)
+++ config/avr/avr.c (working copy)
@@ -5161,7 +5161,7 @@ avr_section_type_flags (tree decl, const
/* Implement `TARGET_ENCODE_SECTION_INFO'. */
static void
-avr_encode_section_info (tree decl, rtx rtl ATTRIBUTE_UNUSED,
+avr_encode_section_info (tree decl, rtx rtl,
int new_decl_p)
{
/* In avr_handle_progmem_attribute, DECL_INITIAL is not yet
@@ -5177,6 +5177,8 @@ avr_encode_section_info (tree decl, rtx
"uninitialized variable %q+D put into "
"program memory area", decl);
}
+
+ default_encode_section_info (decl, rtl, new_decl_p);
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Ping #1: [Patch, AVR]: Fix PR34734
2011-06-29 12:11 ` Georg-Johann Lay
@ 2011-06-29 13:45 ` Weddington, Eric
2011-06-30 14:35 ` Georg-Johann Lay
0 siblings, 1 reply; 8+ messages in thread
From: Weddington, Eric @ 2011-06-29 13:45 UTC (permalink / raw)
To: Georg-Johann Lay, Denis Chertykov; +Cc: gcc-patches, Anatoly Sokolov
> -----Original Message-----
> From: Georg-Johann Lay [mailto:avr@gjlay.de]
> Sent: Wednesday, June 29, 2011 5:26 AM
> To: Denis Chertykov
> Cc: gcc-patches@gcc.gnu.org; Weddington, Eric; Anatoly Sokolov
> Subject: Re: Ping #1: [Patch, AVR]: Fix PR34734
>
> >
> > You can backport it if you want.
> >
> > I'm usually didn't backport such patches.
> >
> > Denis.
>
> Ok, maybe Eric or Anatoly have some preference for 4.5/4.6.
>
I would like it for the 4.6 series, if possible. I think that the next releases of the various avr toolchain distributions will very probably be moving up to 4.6.x.
Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Ping #1: [Patch, AVR]: Fix PR34734
2011-06-29 13:45 ` Weddington, Eric
@ 2011-06-30 14:35 ` Georg-Johann Lay
0 siblings, 0 replies; 8+ messages in thread
From: Georg-Johann Lay @ 2011-06-30 14:35 UTC (permalink / raw)
To: Weddington, Eric; +Cc: Denis Chertykov, gcc-patches, Anatoly Sokolov
Weddington, Eric wrote:
>> -----Original Message-----
>>> You can backport it if you want.
>>>
>>> I'm usually didn't backport such patches.
>>>
>>> Denis.
>> Ok, maybe Eric or Anatoly have some preference for 4.5/4.6.
>
> I would like it for the 4.6 series, if possible. I think that the
> next releases of the various avr toolchain distributions will very
> probably be moving up to 4.6.x.
>
> Eric
http://gcc.gnu.org/viewcvs/branches/gcc-4_6-branch/gcc/config/avr/avr.c?r1=175706&r2=175704&pathrev=175706
Backported to 4.6 and set PR34734 milestone to 4.6.2.
Johann
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-06-30 13:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-20 13:46 [Patch, AVR]: Fix PR34734 Georg-Johann Lay
2011-06-28 12:00 ` Ping #1: " Georg-Johann Lay
2011-06-28 13:58 ` Denis Chertykov
2011-06-29 8:21 ` Georg-Johann Lay
2011-06-29 10:42 ` Denis Chertykov
2011-06-29 12:11 ` Georg-Johann Lay
2011-06-29 13:45 ` Weddington, Eric
2011-06-30 14:35 ` Georg-Johann Lay
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).