Opened 13 years ago
Closed 13 years ago
#1851 closed enhancement (fixed)
Warn on unassigned output variables (Using unbound output variables causes segfault)
| Reported by: | Owned by: | Martin Sjölund | |
|---|---|---|---|
| Priority: | high | Milestone: | 1.9.0 |
| Component: | Frontend | Version: | trunk |
| Keywords: | Cc: |
Description
I'm not sure if I have filed a ticket about this before, I couldn't find it...
This code contains an output variable in the function part that is never assigned, when this value is used afterwards the program segfaults. No warning is given that the output variable isn't assigned a value, so debugging is fairly hard. It would be nice to get a warning if the compiler can tell that an output variable isn't assigned, or if it isn't sure.
Call Test.main() to reproduce.
package Test
function toList
input Tuple<Integer,Integer> t;
output List<Integer> list;
algorithm
list := match t
local Integer n;
case (_,n) then toList_helper(n);
end match;
end toList;
protected function toList_helper
input Integer node;
output List<Integer> list;
algorithm
list := {};
end toList_helper;
function part
output Tuple<Integer,Integer> a;
output Tuple<Integer,Integer> b;
algorithm
(a,a) := ((1,2),(1,2));
end part;
function main
protected
List<Integer> resB;
Tuple<Integer,Integer> b;
algorithm
(_,b) := part();
resB := toList(b);
end main;
end Test;
Change History (2)
comment:1 by , 13 years ago
| Component: | Backend → Frontend |
|---|---|
| Owner: | changed from to |
| Status: | new → accepted |
comment:2 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |
Note:
See TracTickets
for help on using tickets.

Fixed in r13133.