Thread: [Flex-devel] GCC warning comparing signed and unsigned and possible bug
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Timothy A. <tim...@co...> - 2016-09-15 01:30:15
|
Hi guys, I'm seeing a GCC waring in the output from lex which seems to be caused by the following line in flex.skl: YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), YY_G(yy_n_chars), num_to_read ); To fix it should be changed to: YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), YY_G(yy_n_chars), (unsigned) num_to_read ); Something else I noticed is there are two flex.skl files, the output I'm getting seems to be generated by the one in flex/to.do/unicode/flex.skl where num_to_read is defined as int which is fine. However the one in flex/flex.skl defines num_to_read as yy_size_t which is unsigned which means the while loop while ( num_to_read <= 0 ) might not get executed, this looks like a bug. Tim |
From: Will E. <wes...@gm...> - 2016-09-15 09:17:47
|
Which version of flex are you using? Looks like you've got an old version from the filenames you reference. On Thursday, 15 September 2016, 11:10 am +1000, Timothy Arceri <tim...@co...> wrote: > Hi guys, > > I'm seeing a GCC waring in the output from lex which seems to be caused > by the following line in flex.skl: > > YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), > YY_G(yy_n_chars), num_to_read ); > > To fix it should be changed to: > > YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), > YY_G(yy_n_chars), (unsigned) num_to_read ); > > > Something else I noticed is there are two flex.skl files, the output > I'm getting seems to be generated by the one > in flex/to.do/unicode/flex.skl where num_to_read is defined as int > which is fine. However the one in flex/flex.skl defines num_to_read > as yy_size_t which is unsigned which means the while loop while ( > num_to_read <= 0 ) might not get executed, this looks like a bug. > > Tim > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Flex-devel mailing list > Fle...@li... > https://lists.sourceforge.net/lists/listinfo/flex-devel -- Will Estes Flex Project Maintainer wes...@gm... https://github.com/westes/flex |
From: Timothy A. <tim...@co...> - 2016-09-15 17:13:15
|
On Thu, 2016-09-15 at 05:17 -0400, Will Estes wrote: > Which version of flex are you using? Looks like you've got an old > version from the filenames you reference. Version 2.6.0. The filenames are from a zipped copy of the source I downloaded from sourceforges cvs system, they should be the latest possible versions. > > On Thursday, 15 September 2016, 11:10 am +1000, Timothy Arceri <timot > hy....@co...> wrote: > > > > > Hi guys, > > > > I'm seeing a GCC waring in the output from lex which seems to be > > caused > > by the following line in flex.skl: > > > > YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE- > > >yy_ch_buf[number_to_move]), > > YY_G(yy_n_chars), num_to_read ); > > > > To fix it should be changed to: > > > > YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE- > > >yy_ch_buf[number_to_move]), > > YY_G(yy_n_chars), (unsigned) num_to_read ); > > > > > > Something else I noticed is there are two flex.skl files, the > > output > > I'm getting seems to be generated by the one > > in flex/to.do/unicode/flex.skl where num_to_read is defined as int > > which is fine. However the one in flex/flex.skl defines num_to_read > > as yy_size_t which is unsigned which means the while loop while ( > > num_to_read <= 0 ) might not get executed, this looks like a bug. > > > > Tim > > > > > > > > ----------------------------------------------------------------- > > ------------- > > _______________________________________________ > > Flex-devel mailing list > > Fle...@li... > > https://lists.sourceforge.net/lists/listinfo/flex-devel > |
From: Will E. <wes...@gm...> - 2016-09-15 17:44:12
|
You want to get your flex sources from github: https://github.com/westes/flex/releases if you need a pre-built tar ball. Flex hasn't used cvs in years. On Friday, 16 September 2016, 3:12 am +1000, Timothy Arceri <tim...@co...> wrote: > On Thu, 2016-09-15 at 05:17 -0400, Will Estes wrote: > > Which version of flex are you using? Looks like you've got an old > > version from the filenames you reference. > > Version 2.6.0. The filenames are from a zipped copy of the source I > downloaded from sourceforges cvs system, they should be the latest > possible versions. > > > > > On Thursday, 15 September 2016, 11:10 am +1000, Timothy Arceri <timot > > hy....@co...> wrote: > > > > > > > > Hi guys, > > > > > > I'm seeing a GCC waring in the output from lex which seems to be > > > caused > > > by the following line in flex.skl: > > > > > > YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE- > > > >yy_ch_buf[number_to_move]), > > > YY_G(yy_n_chars), num_to_read ); > > > > > > To fix it should be changed to: > > > > > > YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE- > > > >yy_ch_buf[number_to_move]), > > > YY_G(yy_n_chars), (unsigned) num_to_read ); > > > > > > > > > Something else I noticed is there are two flex.skl files, the > > > output > > > I'm getting seems to be generated by the one > > > in flex/to.do/unicode/flex.skl where num_to_read is defined as int > > > which is fine. However the one in flex/flex.skl defines num_to_read > > > as yy_size_t which is unsigned which means the while loop while ( > > > num_to_read <= 0 ) might not get executed, this looks like a bug. > > > > > > Tim > > > > > > > > > > > > ----------------------------------------------------------------- > > > ------------- > > > _______________________________________________ > > > Flex-devel mailing list > > > Fle...@li... > > > https://lists.sourceforge.net/lists/listinfo/flex-devel > > -- Will Estes wes...@gm... |
From: Timothy A. <tim...@co...> - 2016-09-15 23:20:28
|
On Thu, 2016-09-15 at 13:44 -0400, Will Estes wrote: > You want to get your flex sources from github: > > https://github.com/westes/flex/releases if you need a pre-built tar > ball. Flex hasn't used cvs in years. I see. It seems the latest master should no longer give this warning. Maybe you could update the sourceforge homepage with a link to the github repo: http://flex.sourceforge.net/ I found no indications that the project had move. Thanks for all your work. Tim > > On Friday, 16 September 2016, 3:12 am +1000, Timothy Arceri <timothy > .ar...@co...> wrote: > > > > > On Thu, 2016-09-15 at 05:17 -0400, Will Estes wrote: > > > > > > Which version of flex are you using? Looks like you've got an old > > > version from the filenames you reference. > > > > Version 2.6.0. The filenames are from a zipped copy of the source I > > downloaded from sourceforges cvs system, they should be the latest > > possible versions. > > > > > > > > > > > On Thursday, 15 September 2016, 11:10 am +1000, Timothy Arceri > > > <timot > > > hy....@co...> wrote: > > > > > > > > > > > > > > > Hi guys, > > > > > > > > I'm seeing a GCC waring in the output from lex which seems to > > > > be > > > > caused > > > > by the following line in flex.skl: > > > > > > > > YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE- > > > > > > > > > > yy_ch_buf[number_to_move]), > > > > YY_G(yy_n_chars), num_to_read ); > > > > > > > > To fix it should be changed to: > > > > > > > > YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE- > > > > > > > > > > yy_ch_buf[number_to_move]), > > > > YY_G(yy_n_chars), (unsigned) > > > > num_to_read ); > > > > > > > > > > > > Something else I noticed is there are two flex.skl files, the > > > > output > > > > I'm getting seems to be generated by the one > > > > in flex/to.do/unicode/flex.skl where num_to_read is defined as > > > > int > > > > which is fine. However the one in flex/flex.skl defines > > > > num_to_read > > > > as yy_size_t which is unsigned which means the while loop while > > > > ( > > > > num_to_read <= 0 ) might not get executed, this looks like a > > > > bug. > > > > > > > > Tim > > > > > > > > > > > > > > > > ------------------------------------------------------------- > > > > ---- > > > > ------------- > > > > _______________________________________________ > > > > Flex-devel mailing list > > > > Fle...@li... > > > > https://lists.sourceforge.net/lists/listinfo/flex-devel > > > > |