Stratego/XT JIRA  History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: STR-498
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Martin Bravenboer
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Stratego/XT

Stand-alone strc does not report incorrect order of strategy argument.

Created: 2006-01-01 12:16   Updated: 2008-03-31 20:44
Component/s: strc - Stratego compiler
Affects Version/s: 0.16 (Stratego Core Compiler)
Fix Version/s: 0.17

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
Strc hides the output of the C compiler if there is no error, which is a bit of a problem, since the C compiler is currently the only way in which an incorrect order of strategy arguments is reported.

Example:
--------------------------------------
module foo
imports list-cons
strategies

  main =
    foo(ho(![]))

strategies

  foo(arg: (t -> t) * t -> t) =
    arg(![])

strategies

  ho(s) =
    s
--------------------------------------

--------------------------------------
martin@linux:~> strc -i foo.str
[ strc | info ] Compiling 'foo.str'
[ strc | info ] Front-end succeeded : [user/system] = [0.41s/0.92s]
[ strc | info ] Optimization succeeded -O 2 : [user/system] = [0.01s/0.10s]
[ strc | info ] Back-end succeeded : [user/system] = [0.19s/0.23s]
[ strc | info ] C compilation succeeded : [user/system] = [0.30s/0.14s]
[ strc | info ] Compilation succeeded : [user/system] = [0.91s/1.39s]
martin@linux:~>
--------------------------------------

Only at verbosity level 2, the output of the C compiler is reported:
--------------------------------------
[ strc | notice ] Compiling C code
[ strc | notice ] Command: gcc -I /pkg/strategoxt/2005-12-12-16-32/include -I /pkg/strategoxt/2005-12-12-16-32/include -I /home/martin/.nix-profile/include -c foo.c -o foo.o
foo.c: In function `main_0_0':
foo.c:23: warning: passing arg 1 of `foo_1_0' from incompatible pointer type
[ strc | notice ] Linking object code
--------------------------------------

Possible solutions:
* pass -Werror the C compiler
* implement a type-checker for the order of strategies in Stratego (and base the renaming on information produced by this type checker)

 All   Comments   Work Log   Change History      Sort Order:
Karl Trygve Kalleberg [2006-03-02 21:58]
The following code is valid:

----
  main = l3(l2)

  l0 = !5

  l1(s0 : a -> a) = s0

  l2(s1 : (a -> a) * a -> a) = s1(l0)

  l3(s2 : ((a -> a) * a -> a) * a -> a) = s2(l1)
----

Replacing the last def with:

  l3(s2 : ((a -> a) * a -> a) * a -> a) = s2(l1(!6))

should fail to compiler. Even if it succeeded, it should still give the result 5, but the standalone compiler will swallow this code silently, and erroneously result in the term 6.

Martin Bravenboer [2006-12-19 19:58]
This issue is critical for 0.17, since errors in the order of arguments are no longer reported by the C compiler due to the changes in the compilation scheme.

Martin Bravenboer [2006-12-19 20:03]
The stand-alone compiler no longer hides the output of the C compiler. Also, the C compiler does not warn about the order anymore. These order issues should be fixed in STR-497.