oink-stack icon indicating copy to clipboard operation
oink-stack copied to clipboard

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

Open sigmike opened this issue 10 years ago • 4 comments

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

sigmike avatar Feb 22 '15 12:02 sigmike

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<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 14.04. The header comes from the libstdc++6-4.6-dev package.

— Reply to this email directly or view it on GitHub https://github.com/dsw/oink-stack/issues/10.

dsw avatar Feb 23 '15 08:02 dsw

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<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 14.04. The header comes from the libstdc++6-4.6-dev package.

— Reply to this email directly or view it on GitHub https://github.com/dsw/oink-stack/issues/10.

dsw avatar Feb 23 '15 22:02 dsw

Here's a much smaller input:

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

sigmike avatar Feb 28 '15 09:02 sigmike

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 https://github.com/dsw/oink-stack/issues/10#issuecomment-76518730.

dsw avatar Mar 25 '15 03:03 dsw