Age | Commit message (Collapse) | Author |
|
The optimization of a 'case' statement could lead to incorrect
code that would cause an exception at run-time.
Here is an example to show how the optimization went wrong. Start
with the following code:
f({r,#{key:=Val},X}=S) ->
case S of
{r,_,_} ->
setelement(3, Val, S)
end.
(The record operations have already been translated to the
corresponding tuple operations.) The first step in case_opt/3 is
to substitute S to obtain:
f({r,#{key:=Val},X}=S) ->
case {r,#{key:=Val},X} of
{r,_,_} ->
setelement(3, Val, S)
end.
After that substitution the 'case' can be simplified to:
f({r,#{key:=Val},_}=S) ->
case #{key:=Val} of
NewVar ->
setelement(3, Val, S)
end.
That is the result from case_opt/3. Now eval_case/2 notices
that since there is only one clause left in the 'case', the
'case' can eliminated:
f({r,#{key:=Val},_}=S) ->
NewVar = #{key:=Val},
setelement(3, Val, S).
Since the map construction may have a side effect, it was not
eliminated, but assigned to a variable that is never used.
The problem is that '#{key:=Val}' is fine as a pattern, but in a
construction of a new map, the '=>' operator must be used. So the
map construction will fail, generating an exception.
As a conservative correction for a maintenance release, we will
abort the 'case' optimization if the substitution into the 'case'
expression is anything but data items (tuples, conses, or
literals) or variables.
Reported-by: Dmitry Aleksandrov
|
|
* essen/irregardless:
Fix "irregardless" -> "regardless"
|
|
* dgud/debugger/save-state-mac/OTP-12378:
debugger: Fix debugger save options on mac
|
|
* dgud/wx/connect-when-terminating/OTP-12374:
wx: Do not crash server when going down
|
|
|
|
* tombenner/doc_fixes:
Fix grammar and formatting issues
Fix typo ("to use to use")
Add a comma after "For example" when appropriate
Use colons before <code> when appropriate
Move periods inside parenthetical sentences
Add an apostrophe to contractions of "let us"
|
|
* derek121/mnesia-doc-fixes:
Fix grammar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* mikpe/fix-eacces-spelling:
fix eacces spelling
|
|
wxFileDialog:getPaths(FD) always return the empty list
on mac when using file dialog.
|
|
* hans/eldap/bad_return_close/OTP-12349:
eldap: Remove trailing white space.
eldap: Test cases for a few return values (open, close)
eldap: updated eldap:close in tests
eldap: Makes close/1 return as documented.
|
|
* hans/eldap/test_improvents/OTP-12355:
eldap: Corrects SSL over IPv6 test.
eldap: Removes eldap_misc_SUITE that is now included in eldap_basic_SUITE.
eldap: Add encode/decode tests.
eldap: Merge eldap_connections_SUITE into eldab_basic_SUITE
eldap: Adds ssl to connections test suite
eldap: Updates basic test suite - Splits one large testcase into smaller ones. - Makes tests independent - Adds some tests.
|
|
If a connect request was made during the takedown of wx it would crash.
|
|
* haguenau/fix-endianness-speling:
Replaced "Endianess" with "Endianness" everywhere
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Splits one large testcase into smaller ones.
- Makes tests independent
- Adds some tests.
|
|
* ia/ssh/ssh-connection-protocol-timeout/OTP-12004:
ssh: Improve errorhandling in ssh_connection.erl
|
|
If a channel is closed by the peer while using a function with call semantics
in ssh_connection.erl return {error, closed}. Document that the functions
can return {error, timeout | closed} and not only ssh_request_status()
|
|
* marcus/revert-ssh-testcase2/OTP-12004:
fix failed conflict resolution
|
|
|
|
* marcus/fix-eldap-notes:
add missing release notes
|
|
|
|
* rickard/atomic64/OTP-12351:
Use the new 64-bit atomic ops API
Introduce a 64-bit atomic ops API
|
|
|
|
The 64-bit atomic ops API is implemented by
* native word size atomic ops on 64-bit architectures, and
* native double word size atomic ops on 32-bit architectures
when available. When native double word size atomic is not
available, the fallback using modification counters is
used.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* hans/ssh/fix_app_appup:
ssh: Fix syntax error in .appup
|
|
|
|
* marcus/revert-ssh-testcase/OTP-12004:
revert ssh testcase
|
|
|
|
* dgud/debugger/still-invoked-gs-functions/OTP-12357:
debugger: Do not use the old removed gs functionality
|