Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error (state 296) at <name>: __niter #10

Open
sigmike opened this issue Feb 22, 2015 · 4 comments
Open

Parse error (state 296) at <name>: __niter #10

sigmike opened this issue Feb 22, 2015 · 4 comments

Comments

@sigmike
Copy link

sigmike commented Feb 22, 2015

Hello,

I get this error in a STL header:

In state 296, I expected one of these tokens:
  (, ), [, ], ->, ., +, -, ++, --, &, *, .*, ->*, /, %, <<, >>, <, <=, >, >=, ==, !=, ^, |, &&, ||, ?, :, =, *=, /=, %=, +=, -=, &=, ^=, |=, <<=, >>=, ,, ..., ;, }, __attribute__, <?, >?, 
/usr/include/c++/4.6/bits/stl_algobase.h:731:32: Parse error (state 296) at <name>: __niter

I've reduced the input with delta to this:

namespace std __attribute__ ((__visibility__ ("default"))) {
  template<class _Sp, class _Tp> struct __traitor {};
  template<typename _Tp> struct __is_integer {};
  template<typename _Tp> struct __is_floating {};
  template<typename _Tp> struct __is_pointer {};
  template<typename _Tp> struct __is_arithmetic : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > {};
  template<typename _Tp> struct __is_scalar : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > {};
}
namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
  template<bool, typename> struct __enable_if {};
}
namespace std __attribute__ ((__visibility__ ("default"))) {
  template<typename _OutputIterator, typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) {
    for (__decltype(__n + 0) __niter = __n; __niter > 0; --__niter, ++__first)
      *__first = __value;
  }

I'm using gcc 4.6.3 and oink master with the lattice config on an clean Ubuntu 12.04. The header comes from the libstdc++6-4.6-dev package.

Edit: Ubuntu 12.04 instead of 14.04

@dsw
Copy link
Owner

dsw commented Feb 23, 2015

Can I ask you to please make an effort to minimize the input just a bit
further? I am rather sure that it can be made a bit smaller; you will
likely need to do it by hand rather than using an automated tool such as
delta.

Daniel

On Sun, Feb 22, 2015 at 4:59 AM, Michaël Witrant [email protected]
wrote:

Hello,

I get this error in a STL header:

In state 296, I expected one of these tokens:
(, ), [, ], ->, ., +, -, ++, --, &, , ., ->*, /, %, <<, >>, <, <=, >, >=, ==, !=, ^, |, &&, ||, ?, :, =, *=, /=, %=, +=, -=, &=, ^=, |=, <<=, >>=, ,, ..., ;, }, attribute, <?, >?,
/usr/include/c++/4.6/bits/stl_algobase.h:731:32: Parse error (state 296) at : __niter

I've reduced the input with delta to this:

namespace std attribute ((visibility ("default"))) {
template<class _Sp, class _Tp> struct traitor {};
template struct __is_integer {};
template struct __is_floating {};
template struct __is_pointer {};
template struct __is_arithmetic : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > {};
template struct __is_scalar : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > {};
}namespace __gnu_cxx __attribute
((visibility ("default"))) {
template<bool, typename> struct enable_if {};
}namespace std __attribute
((visibility ("default"))) {
template<typename _OutputIterator, typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) {
for (__decltype(__n + 0) __niter = __n; __niter > 0; --__niter, ++__first)
*__first = __value;
}

I'm using gcc 4.6.3 and oink master with the lattice config on an clean
Ubuntu 14.04. The header comes from the libstdc++6-4.6-dev package.


Reply to this email directly or view it on GitHub
#10.

@dsw
Copy link
Owner

dsw commented Feb 23, 2015

Allow me to clarify: this is a string that the parser cannot parse, so
certainly a smaller input will also induce the parser into the same state.

On Mon, Feb 23, 2015 at 12:10 AM, Daniel Wilkerson <
[email protected]> wrote:

Can I ask you to please make an effort to minimize the input just a bit
further? I am rather sure that it can be made a bit smaller; you will
likely need to do it by hand rather than using an automated tool such as
delta.

Daniel

On Sun, Feb 22, 2015 at 4:59 AM, Michaël Witrant <[email protected]

wrote:

Hello,

I get this error in a STL header:

In state 296, I expected one of these tokens:
(, ), [, ], ->, ., +, -, ++, --, &, , ., ->*, /, %, <<, >>, <, <=, >, >=, ==, !=, ^, |, &&, ||, ?, :, =, *=, /=, %=, +=, -=, &=, ^=, |=, <<=, >>=, ,, ..., ;, }, attribute, <?, >?,
/usr/include/c++/4.6/bits/stl_algobase.h:731:32: Parse error (state 296) at : __niter

I've reduced the input with delta to this:

namespace std attribute ((visibility ("default"))) {
template<class _Sp, class _Tp> struct traitor {};
template struct __is_integer {};
template struct __is_floating {};
template struct __is_pointer {};
template struct __is_arithmetic : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > {};
template struct __is_scalar : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > {};
}namespace __gnu_cxx __attribute
((visibility ("default"))) {
template<bool, typename> struct enable_if {};
}namespace std __attribute
((visibility ("default"))) {
template<typename _OutputIterator, typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) {
for (__decltype(__n + 0) __niter = __n; __niter > 0; --__niter, ++__first)
*__first = __value;
}

I'm using gcc 4.6.3 and oink master with the lattice config on an clean
Ubuntu 14.04. The header comes from the libstdc++6-4.6-dev package.


Reply to this email directly or view it on GitHub
#10.

@sigmike
Copy link
Author

sigmike commented Feb 28, 2015

Here's a much smaller input:

void a(int b) {
  __decltype(b + 0) c;
}

@dsw
Copy link
Owner

dsw commented Mar 25, 2015

Thank you for the bug report and the extra effort to minimize the example;
however I just have too many other important things to work on right now to
spend time on this.

Scott says the following: "There is a debug flag to elkhound that will
print all the states and their associated gram[m]ar productions. Use that
to decode the state number to see where it got stuck."

If you follow Scott's suggestion, then the output from elkhound about what
state the parser is in may tell you how the grammar needs to be altered.
Since the grammar is GLR, it is quite robust against shift-reduce and
reduce-reduce conflicts, so if you figure out the error, it should be easy
to fix.

If you manage to fix it, do send me a pull request and if it looks sane and
builds and passes on my machine, I'll incorporate it into the mainline.

Sorry, but I basically have to rely on others to take the time to
investigate these bugs right now, but I can offer the kind of advice above
and can test and merge fixes when people send them.

Daniel

On Sat, Feb 28, 2015 at 1:26 AM, Michaël Witrant [email protected]
wrote:

Here's a much smaller input:

void a(int b) {
__decltype(b + 0) c;
}


Reply to this email directly or view it on GitHub
#10 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants