* [PATCH] Fix PRs c/52283/37985
@ 2012-04-04 8:17 Christian Bruel
2012-04-04 9:39 ` Manuel López-Ibáñez
2012-04-14 14:53 ` Manuel López-Ibáñez
0 siblings, 2 replies; 5+ messages in thread
From: Christian Bruel @ 2012-04-04 8:17 UTC (permalink / raw)
To: gcc-patches, manu
[-- Attachment #1: Type: text/plain, Size: 192 bytes --]
Hello,
Is it OK to push the cleaning of TREE_NO_WARNING to fix the constant
expressions errors discrepancies, as discussed in bugzilla #52283, now
that the trunk is open ?
Many thanks,
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: case-label.patch --]
[-- Type: text/x-patch; name="case-label.patch", Size: 4184 bytes --]
2012-03-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/52283/37985
* stmt.c (warn_if_unused_value): Skip NOP_EXPR.
* convert.c (convert_to_integer): Don't set TREE_NO_WARNING.
2010-03-29 Christian Bruel <christian.bruel@st.com>
PR c/52283
* gcc.dg/case-const-1.c: Test constant expression.
* gcc.dg/case-const-2.c: Likewise.
* gcc.dg/case-const-3.c: Likewise.
2012-03-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc/testsuite/gcc.dg/pr37985.c: New test.
Index: gcc/testsuite/gcc.dg/pr37985.c
===================================================================
--- gcc/testsuite/gcc.dg/pr37985.c (revision 0)
+++ gcc/testsuite/gcc.dg/pr37985.c (revision 0)
@@ -0,0 +1,8 @@
+/* PR c/37985 */
+/* { dg-do compile } */
+/* { dg-options " -Wall -Wextra " } */
+unsigned char foo(unsigned char a)
+{
+ a >> 2; /* { dg-warning "no effect" } */
+ return a;
+}
Index: gcc/testsuite/gcc.dg/case-const-1.c
===================================================================
--- gcc/testsuite/gcc.dg/case-const-1.c (revision 186082)
+++ gcc/testsuite/gcc.dg/case-const-1.c (working copy)
@@ -1,9 +1,11 @@
/* Test for case labels not integer constant expressions but folding
- to integer constants (used in Linux kernel, PR 39613). */
+ to integer constants (used in Linux kernel, PR 39613, 52283). */
/* { dg-do compile } */
/* { dg-options "" } */
extern int i;
+extern unsigned int u;
+
void
f (int c)
{
@@ -13,3 +15,13 @@
;
}
}
+
+void
+b (int c)
+{
+ switch (c)
+ {
+ case (int) (2 | ((4 < 8) ? 8 : u)):
+ ;
+ }
+}
Index: gcc/testsuite/gcc.dg/case-const-2.c
===================================================================
--- gcc/testsuite/gcc.dg/case-const-2.c (revision 186082)
+++ gcc/testsuite/gcc.dg/case-const-2.c (working copy)
@@ -1,9 +1,11 @@
/* Test for case labels not integer constant expressions but folding
- to integer constants (used in Linux kernel, PR 39613). */
+ to integer constants (used in Linux kernel, PR 39613, 52283). */
/* { dg-do compile } */
/* { dg-options "-pedantic" } */
extern int i;
+extern unsigned int u;
+
void
f (int c)
{
@@ -13,3 +15,14 @@
;
}
}
+
+void
+b (int c)
+{
+ switch (c)
+ {
+ case (int) (2 | ((4 < 8) ? 8 : u)): /* { dg-warning "case label is not an integer constant expression" } */
+ ;
+ }
+}
+
Index: gcc/testsuite/gcc.dg/case-const-3.c
===================================================================
--- gcc/testsuite/gcc.dg/case-const-3.c (revision 186082)
+++ gcc/testsuite/gcc.dg/case-const-3.c (working copy)
@@ -1,9 +1,11 @@
/* Test for case labels not integer constant expressions but folding
- to integer constants (used in Linux kernel, PR 39613). */
+ to integer constants (used in Linux kernel, PR 39613, 52283, ). */
/* { dg-do compile } */
/* { dg-options "-pedantic-errors" } */
extern int i;
+extern unsigned int u;
+
void
f (int c)
{
@@ -13,3 +15,16 @@
;
}
}
+
+void
+b (int c)
+{
+ switch (c)
+ {
+ case (int) (2 | ((4 < 8) ? 8 : u)): /* { dg-error "case label is not an integer constant expression" } */
+ ;
+ }
+}
+
+
+
Index: gcc/stmt.c
===================================================================
--- gcc/stmt.c (revision 186082)
+++ gcc/stmt.c (working copy)
@@ -1515,6 +1515,7 @@
case SAVE_EXPR:
case NON_LVALUE_EXPR:
+ case NOP_EXPR:
exp = TREE_OPERAND (exp, 0);
goto restart;
Index: gcc/convert.c
===================================================================
--- gcc/convert.c (revision 186082)
+++ gcc/convert.c (working copy)
@@ -542,7 +542,6 @@
else if (outprec >= inprec)
{
enum tree_code code;
- tree tem;
/* If the precision of the EXPR's type is K bits and the
destination mode has more bits, and the sign is changing,
@@ -560,13 +559,7 @@
else
code = NOP_EXPR;
- tem = fold_unary (code, type, expr);
- if (tem)
- return tem;
-
- tem = build1 (code, type, expr);
- TREE_NO_WARNING (tem) = 1;
- return tem;
+ return fold_build1 (code, type, expr);
}
/* If TYPE is an enumeral type or a type with a precision less
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PRs c/52283/37985
2012-04-04 8:17 [PATCH] Fix PRs c/52283/37985 Christian Bruel
@ 2012-04-04 9:39 ` Manuel López-Ibáñez
2012-04-04 11:06 ` Christian Bruel
2012-04-14 14:53 ` Manuel López-Ibáñez
1 sibling, 1 reply; 5+ messages in thread
From: Manuel López-Ibáñez @ 2012-04-04 9:39 UTC (permalink / raw)
To: Christian Bruel; +Cc: gcc-patches, manu
Hi Christian,
You have to add the testcases from both PR52283 and PR37985, and an
appropriate Changelog, and bootstrap+regression test everything and
double-check that the new testcases don't fail and no old testcases
fail with the patch (by comparing with the testcases that fail without
the patch).
Cheers,
Manuel.
On 4 April 2012 10:17, Christian Bruel <christian.bruel@st.com> wrote:
> Hello,
>
> Is it OK to push the cleaning of TREE_NO_WARNING to fix the constant
> expressions errors discrepancies, as discussed in bugzilla #52283, now that
> the trunk is open ?
>
> Many thanks,
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PRs c/52283/37985
2012-04-04 9:39 ` Manuel López-Ibáñez
@ 2012-04-04 11:06 ` Christian Bruel
2012-04-04 11:25 ` Manuel López-Ibáñez
0 siblings, 1 reply; 5+ messages in thread
From: Christian Bruel @ 2012-04-04 11:06 UTC (permalink / raw)
To: Manuel López-Ibáñez; +Cc: gcc-patches, manu
On 04/04/2012 11:38 AM, Manuel López-Ibáñez wrote:
> Hi Christian,
>
> You have to add the testcases from both PR52283 and PR37985, and an
> appropriate Changelog, and bootstrap+regression test everything and
> double-check that the new testcases don't fail and no old testcases
> fail with the patch (by comparing with the testcases that fail without
> the patch).
The testscase was part of the attached patch, along with the ChangeLog
entries
It was bootstrapped and regtested for C and C++ on x86 (that was in
bugzilla comment #22), sorry I should have mentioned it here too. done
now :)
Cheers
Christian
>
> Cheers,
>
> Manuel.
>
> On 4 April 2012 10:17, Christian Bruel<christian.bruel@st.com> wrote:
>> Hello,
>>
>> Is it OK to push the cleaning of TREE_NO_WARNING to fix the constant
>> expressions errors discrepancies, as discussed in bugzilla #52283, now that
>> the trunk is open ?
>>
>> Many thanks,
>>
>>
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PRs c/52283/37985
2012-04-04 11:06 ` Christian Bruel
@ 2012-04-04 11:25 ` Manuel López-Ibáñez
0 siblings, 0 replies; 5+ messages in thread
From: Manuel López-Ibáñez @ 2012-04-04 11:25 UTC (permalink / raw)
To: Christian Bruel; +Cc: gcc-patches
On 4 April 2012 13:05, Christian Bruel <christian.bruel@st.com> wrote:
>
>
> The testscase was part of the attached patch, along with the ChangeLog
> entries
You are right! Sorry, I may have been looking at the wrong place.
> It was bootstrapped and regtested for C and C++ on x86 (that was in bugzilla
> comment #22), sorry I should have mentioned it here too. done now :)
Thanks for taking care of this.
Cheers,
Manuel.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PRs c/52283/37985
2012-04-04 8:17 [PATCH] Fix PRs c/52283/37985 Christian Bruel
2012-04-04 9:39 ` Manuel López-Ibáñez
@ 2012-04-14 14:53 ` Manuel López-Ibáñez
1 sibling, 0 replies; 5+ messages in thread
From: Manuel López-Ibáñez @ 2012-04-14 14:53 UTC (permalink / raw)
To: Christian Bruel; +Cc: gcc-patches, Joseph S. Myers, Richard Henderson
As far as I know, this patch hasn't been reviewed:
http://patchwork.ozlabs.org/patch/150636/
Cheers,
Manuel.
On 4 April 2012 10:17, Christian Bruel <christian.bruel@st.com> wrote:
> Hello,
>
> Is it OK to push the cleaning of TREE_NO_WARNING to fix the constant
> expressions errors discrepancies, as discussed in bugzilla #52283, now that
> the trunk is open ?
>
> Many thanks,
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-14 14:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04 8:17 [PATCH] Fix PRs c/52283/37985 Christian Bruel
2012-04-04 9:39 ` Manuel López-Ibáñez
2012-04-04 11:06 ` Christian Bruel
2012-04-04 11:25 ` Manuel López-Ibáñez
2012-04-14 14:53 ` Manuel López-Ibáñez
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).