diff mbox

pr51020 Fix invalid options validation for ARM target

Message ID 20120501192128.GA3806@kayrick-lair
State New
Headers show

Commit Message

Alexey Kravets May 1, 2012, 7:21 p.m. UTC
On Mon, Apr 30, 2012 at 02:15:03PM +0100, Richard Earnshaw wrote:
> On 28/04/12 11:04, Alexey Kravets wrote:
> > Hi guys,
> > Please, take a look at this patch. It fixes the invalid star symbol
> > processing in validate_switches function reported in GCC bugzilla:
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51020
> > 
> > With this patch invalid options are no  longer accepted by the 
> > compiler (see new testcase for more details).
> > It showed no regressions on GCC-4.6.3 on ARM.
> > 
> > ChangeLog:
> >   * gcc/gcc.c(validate_switches): Reset starred flag.
> >   * gcc/testsuite/gcc.target/arm/pr51020.c: New test.
> > 
> 
> Why have you created an arm-specific test for something that, at least
> on initial examination, is a generic issue?
Yes, that is my bad. I have updated the test to be generic and rerun
testsuite on x86_64 machine (with no regressions). The updated patch is
attached.
> 
> R.
>

Comments

Alexey Kravets May 25, 2012, 2:29 p.m. UTC | #1
Hi guys,
This issue has not been fixed in latest Linaro release (4.6.2012.04) yet.
Can you suggest whether this patch is a correct fix for the  pr51020.
If so, should it be applied to the corresponding gcc branch?
On Tue, May 01, 2012 at 11:21:28PM +0400, Alexey Kravets wrote:
> On Mon, Apr 30, 2012 at 02:15:03PM +0100, Richard Earnshaw wrote:
> > On 28/04/12 11:04, Alexey Kravets wrote:
> > > Hi guys,
> > > Please, take a look at this patch. It fixes the invalid star symbol
> > > processing in validate_switches function reported in GCC bugzilla:
> > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51020
> > > 
> > > With this patch invalid options are no  longer accepted by the 
> > > compiler (see new testcase for more details).
> > > It showed no regressions on GCC-4.6.3 on ARM.
> > > 
> > > ChangeLog:
> > >   * gcc/gcc.c(validate_switches): Reset starred flag.
> > >   * gcc/testsuite/gcc.target/arm/pr51020.c: New test.
> > > 
> > 
> > Why have you created an arm-specific test for something that, at least
> > on initial examination, is a generic issue?
> Yes, that is my bad. I have updated the test to be generic and rerun
> testsuite on x86_64 machine (with no regressions). The updated patch is
> attached.
> > 
> > R.
> > 
> 
> -- 
> Alexey Kravets
> mr.kayrick@gmail.com

> diff --git a/gcc/gcc.c b/gcc/gcc.c
> index 75f522e..e3c8609 100644
> --- a/gcc/gcc.c
> +++ b/gcc/gcc.c
> @@ -7023,11 +7023,12 @@ validate_switches (const char *start)
>    size_t len;
>    int i;
>    bool suffix = false;
> -  bool starred = false;
> +  bool starred;
>  
>  #define SKIP_WHITE() do { while (*p == ' ' || *p == '\t') p++; } while (0)
>  
>  next_member:
> +  starred = false;
>    SKIP_WHITE ();
>  
>    if (*p == '!')
> diff --git a/gcc/testsuite/gcc.dg/pr51020.c b/gcc/testsuite/gcc.dg/pr51020.c
> new file mode 100644
> index 0000000..ac77dc1
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr51020.c
> @@ -0,0 +1,5 @@
> +/* PR 51020 */
> +/* { dg-do compile } */
> +/* { dg-options "---" } */
> +int main() {return 0;}
> +/* { dg-error "unrecognized.*'---'" ""  { target *-*-* } 0 } */
> -- 
> 1.7.5.4
>
diff mbox

Patch

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 75f522e..e3c8609 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -7023,11 +7023,12 @@  validate_switches (const char *start)
   size_t len;
   int i;
   bool suffix = false;
-  bool starred = false;
+  bool starred;
 
 #define SKIP_WHITE() do { while (*p == ' ' || *p == '\t') p++; } while (0)
 
 next_member:
+  starred = false;
   SKIP_WHITE ();
 
   if (*p == '!')
diff --git a/gcc/testsuite/gcc.dg/pr51020.c b/gcc/testsuite/gcc.dg/pr51020.c
new file mode 100644
index 0000000..ac77dc1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr51020.c
@@ -0,0 +1,5 @@ 
+/* PR 51020 */
+/* { dg-do compile } */
+/* { dg-options "---" } */
+int main() {return 0;}
+/* { dg-error "unrecognized.*'---'" ""  { target *-*-* } 0 } */
-- 
1.7.5.4