Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Strange runtime error in Compiled function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127548] Strange runtime error in Compiled function
  • From: Axel <axel.kowald at gmail.com>
  • Date: Fri, 3 Aug 2012 04:17:00 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Hi everybody,
I'm using Mathematica 8.0.1 on a 32bit Win7 system and I have strange problems with the Compile function.
I have this simple function:

compileTestC = Compile[{{paramList, _Integer, 1}},
   Module[{a, b},
    Print[paramList[[1]]];
    a = paramList[[1]];
    
    If[False,
     b = 1,
     b = 0
     ] ;
    Return[5]
    ] 
   ] ; 
   
When I compile and run it the first time, it produces the expected results:
compileTestC[{100}] 
100
5

But for all subsequent calls I get this strange error message:
compileTestC[{100}] 
100
CompiledFunction::cflist: Nontensor object generated; proceeding with uncompiled evaluation. >>
100
5

Furthermore, small changes to the source code make the error disappear. 
For instance deleting the line "a = paramList[[1]];" or deleting the If statement.

This sounds really crazy for me and I have no idea what's going on.
Can anybody help ?  Maybe it's a bug in Mathematica ?

Thanks,
  Axel



  • Prev by Date: Re: Data Format
  • Next by Date: Re: Mathematica as a New Approach to Teaching Maths
  • Previous by thread: Re: ListContourPlot
  • Next by thread: Re: Strange runtime error in Compiled function