| Author |
Message |
|
| Guest |
Posted: Tue Jul 06, 2010 11:22 am |
|
|
|
Guest
|
Hi,
The following module produces a compiler error in R13B03 and R13B04:
-module(a).
f() -> hipe is broken.
The error is, just as expected:
$> erlc a.erl
a.erl:2: syntax error before: is
However, if the compiler is HiPE compiled (with NATIVE_LIBS_ENABLED=yes), the following error occurs:
$> erlc a.erl
a.erl:none: internal error in parse_module;
crash reason: {function_clause,[{erl_parse,yeccpars2_6,7},
{erl_parse,yeccpars0,5},
{epp,parse_file,1},
{epp,parse_file,1},
{epp,parse_file,3},
{compile,parse_module,1},
{compile,'-internal_comp/4-anonymous-1-',2},
{compile,fold_comp,3}]}
Cheers,
Adam
________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Jul 06, 2010 12:12 pm |
|
|
|
Guest
|
Adam Lindberg writes:
> Hi,
>
> The following module produces a compiler error in R13B03 and R13B04:
>
> -module(a).
> f() -> hipe is broken.
>
>
> The error is, just as expected:
> $> erlc a.erl
> a.erl:2: syntax error before: is
>
>
> However, if the compiler is HiPE compiled (with NATIVE_LIBS_ENABLED=yes), the following error occurs:
>
> $> erlc a.erl
> a.erl:none: internal error in parse_module;
> crash reason: {function_clause,[{erl_parse,yeccpars2_6,7},
> {erl_parse,yeccpars0,5},
> {epp,parse_file,1},
> {epp,parse_file,1},
> {epp,parse_file,3},
> {compile,parse_module,1},
> {compile,'-internal_comp/4-anonymous-1-',2},
> {compile,fold_comp,3}]}
I can't reproduce this with R14A on i686-linux.
If you can still trigger the failure with R14A, please show us the
complete sequence of steps needed to reproduce it.
/Mikael
________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Jul 06, 2010 3:59 pm |
|
|
|
Guest
|
Mikael Pettersson wrote:
> Adam Lindberg writes:
> > Hi,
> >
> > The following module produces a compiler error in R13B03 and R13B04:
> >
> > -module(a).
> > f() -> hipe is broken.
> >
> >
> > The error is, just as expected:
> > $> erlc a.erl
> > a.erl:2: syntax error before: is
> >
> >
> > However, if the compiler is HiPE compiled (with NATIVE_LIBS_ENABLED=yes), the following error occurs:
> >
> > $> erlc a.erl
> > a.erl:none: internal error in parse_module;
> > crash reason: {function_clause,[{erl_parse,yeccpars2_6,7},
> > {erl_parse,yeccpars0,5},
> > {epp,parse_file,1},
> > {epp,parse_file,1},
> > {epp,parse_file,3},
> > {compile,parse_module,1},
> > {compile,'-internal_comp/4-anonymous-1-',2},
> > {compile,fold_comp,3}]}
>
> I can't reproduce this with R14A on i686-linux.
>
> If you can still trigger the failure with R14A, please show us the
> complete sequence of steps needed to reproduce it.
The behaviour is reproducible.
At least in my system that has kernel, stdlib, compiler and hipe all in
native code (configure --enable-native-libs) the following sequence of
commands shows the difference if one native compiles or not only one
specific file.
@hektor [~/.../otp] cd lib/stdlib/src
@hektor [~/.../otp/lib/stdlib/src] erlc -W +debug_info -I../include
-I../../kernel/include -o../ebin erl_parse.erl
@hektor [~/.../otp/lib/stdlib/src] erlc a.erl
./a.erl:3: syntax error before: is
@hektor [~/HiPE/otp/lib/stdlib/src] erlc -W +debug_info +native
-I../include -I../../kernel/include -o../ebin erl_parse.erl
@hektor [~/.../otp/lib/stdlib/src] erlc a.erl
./a.erl:none: internal error in parse_module;
crash reason: {function_clause,[{erl_parse,yeccpars2_6,7},
{erl_parse,yeccpars0,5},
{epp,parse_file,1},
{epp,parse_file,1},
{epp,parse_file,3},
{compile,parse_module,1},
{compile,'-internal_comp/4-anonymous-1-',2},
{compile,fold_comp,3}]}
Kostis
________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Jul 06, 2010 4:32 pm |
|
|
|
Guest
|
I managed to pinpoint the error to erl_parse. If you compile only erl_parse without hipe it works as it should.
Cheers,
Adam
----- "Kostis Sagonas" <kostis@cs.ntua.gr> wrote:
> Mikael Pettersson wrote:
> > Adam Lindberg writes:
> > > Hi,
> > >
> > > The following module produces a compiler error in R13B03 and
> R13B04:
> > >
> > > -module(a).
> > > f() -> hipe is broken.
> > >
> > >
> > > The error is, just as expected:
> > > $> erlc a.erl
> > > a.erl:2: syntax error before: is
> > >
> > >
> > > However, if the compiler is HiPE compiled (with
> NATIVE_LIBS_ENABLED=yes), the following error occurs:
> > >
> > > $> erlc a.erl
> > > a.erl:none: internal error in parse_module;
> > > crash reason: {function_clause,[{erl_parse,yeccpars2_6,7},
> > > {erl_parse,yeccpars0,5},
> > > {epp,parse_file,1},
> > > {epp,parse_file,1},
> > > {epp,parse_file,3},
> > > {compile,parse_module,1},
> > >
> {compile,'-internal_comp/4-anonymous-1-',2},
> > > {compile,fold_comp,3}]}
> >
> > I can't reproduce this with R14A on i686-linux.
> >
> > If you can still trigger the failure with R14A, please show us the
> > complete sequence of steps needed to reproduce it.
>
> The behaviour is reproducible.
>
> At least in my system that has kernel, stdlib, compiler and hipe all
> in
> native code (configure --enable-native-libs) the following sequence of
>
> commands shows the difference if one native compiles or not only one
> specific file.
>
> @hektor [~/.../otp] cd lib/stdlib/src
> @hektor [~/.../otp/lib/stdlib/src] erlc -W +debug_info -I../include
> -I../../kernel/include -o../ebin erl_parse.erl
> @hektor [~/.../otp/lib/stdlib/src] erlc a.erl
> ./a.erl:3: syntax error before: is
> @hektor [~/HiPE/otp/lib/stdlib/src] erlc -W +debug_info +native
> -I../include -I../../kernel/include -o../ebin erl_parse.erl
> @hektor [~/.../otp/lib/stdlib/src] erlc a.erl
> ./a.erl:none: internal error in parse_module;
> crash reason: {function_clause,[{erl_parse,yeccpars2_6,7},
> {erl_parse,yeccpars0,5},
> {epp,parse_file,1},
> {epp,parse_file,1},
> {epp,parse_file,3},
> {compile,parse_module,1},
>
> {compile,'-internal_comp/4-anonymous-1-',2},
> {compile,fold_comp,3}]}
>
> Kostis
________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Jul 07, 2010 7:47 am |
|
|
|
Guest
|
case atom_to_list(F) of
"yeccpars2" ++ _ ->
{syntax_error, Token};
"yeccgoto_" ++ SymbolL ->
{ok,[{atom,_,Symbol}],_} = erl_scan:string(SymbolL),
{missing_in_goto_table, Symbol, State}
end.
Adam Lindberg wrote:
> Hi,
>
> The following module produces a compiler error in R13B03 and R13B04:
>
> -module(a).
> f() -> hipe is broken.
>
>
> The error is, just as expected:
> $> erlc a.erl
> a.erl:2: syntax error before: is
>
>
> However, if the compiler is HiPE compiled (with NATIVE_LIBS_ENABLED=yes), the following error occurs:
>
> $> erlc a.erl
> a.erl:none: internal error in parse_module;
> crash reason: {function_clause,[{erl_parse,yeccpars2_6,7},
> {erl_parse,yeccpars0,5},
> {epp,parse_file,1},
> {epp,parse_file,1},
> {epp,parse_file,3},
> {compile,parse_module,1},
> {compile,'-internal_comp/4-anonymous-1-',2},
> {compile,fold_comp,3}]}
I've investigated this issue.
The good news is that there is no problem in the code generated by the
hipe compiler.
Instead, the problem is that the code of yeccpre.hrl heavily relies on
generated exceptions having stack traces of particular forms, which is
currently not something that native code guarantees.
In parsetools/include/yeccpre.hrl there is code which reads:
yecc_error_type(function_clause, [{?MODULE,F,[State,_,_,_,Token,_,_]} |
_]) ->
case atom_to_list(F) of
"yeccpars2" ++ _ ->
{syntax_error, Token};
"yeccgoto_" ++ SymbolL ->
{ok,[{atom,_,Symbol}],_} = erl_scan:string(SymbolL),
{missing_in_goto_table, Symbol, State}
end.
while the stack trace that native-compiled code generates has the form:
yecc_error_type(function_clause, [{?MODULE,F,7} | _]) ->
If one can live with uninformative syntax errors, one solution is to add
such a clause for yecc_error_type/2 and return some other error terms
for this case, which should then be handled in function yeccparse0/5.
In other words, add a clause:
yecc_error_type(function_clause, [{?MODULE,F,7} | _]) ->
case atom_to_list(F) of
"yeccpars2" ++ _ ->
syntax_error;
"yeccgoto_" ++ SymbolL ->
{ok,[{atom,_,Symbol}],_} = erl_scan:string(SymbolL),
{missing_in_goto_table, Symbol}
end.
This is relatively easy.
Another solution is to add an attribute to yeccpre.hrl that prohibits
native code compilation of this module:
-compile(no_native).
Perhaps this is the best solution for the time being.
Of course, a better solution would be for native code to generate the
exact same stack traces as BEAM code, but this is very complicated and
will not happen soon (if at all). However, even if that were available,
I still believe that writing Erlang code that relies on stack traces
having a specific form is not kosher.
I will let the OTP folks at Ericsson take a decision on what to do about
this one.
Kostis
________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|