[erlang-bugs] A possibly-spurious warning message on 18.0-rc1 when enabling compile inline option
Kenji Rikitake
kenji@REDACTED
Sat Apr 25 03:13:04 CEST 2015
A warning message, which does not make sense, is generated when
compiling the following code on 18.0-rc1 (both on FreeBSD and OS X):
erlc -Werror buftest.erl
compile: warnings being treated as errors
buftest.erl:15: a term is constructed, but never used
This doesn't happen on 17.5,
and this message is not generated when
`-compile({inline, [loop/1]})` doesn't exist.
buftest.erl source code:
-module(buftest).
-export([
loop/1
]).
-compile({inline, [loop/1]}).
calc(H, H2) ->
ok = io:format("H = ~p, H2 = ~p~n", [H, H2]),
H2.
loop({[H], RL}) ->
NL = lists:reverse(RL),
loop({[H|NL], []}); % <- this line generates the warning
loop({L, RL}) ->
[H|L2] = L,
[H2|L3] = L2,
NH2 = calc(H, H2),
NL2 = [NH2|L3],
NRL = [H|RL],
{NL2, NRL}.
More information about the erlang-bugs
mailing list