Giter Site home page Giter Site logo

Comments (3)

Emoun avatar Emoun commented on August 26, 2024

I tried manually executing all compilation steps. I.e. use patmos-clang to compile to bitcode and patmos-llc to compile to machine code. When llc is given the -O0 flag, the above assertion error is thrown. But if it is given -O1, -O2, or -O3 the compilation will succeed, but the execution will return the wrong result. E.g. when given the input 10 55 it returns 55 instead of 1050.

from patmos-llvm.

Emoun avatar Emoun commented on August 26, 2024

The same problem is seen when goto breakLoops is replaced by a return x. (the programs are equivalent)

from patmos-llvm.

Emoun avatar Emoun commented on August 26, 2024

Trying to continue an outer loop from an inner nested loop also given error. Take the following program, where we emulate continue using a goto:

#include <stdio.h>

int init_func(int pre, int inner, int post){
  int x = 0, y = 0, z = 0;
  outer_loop:
  #pragma loopbound min 0 max 9
  while(x < pre){
    x++;
    #pragma loopbound min 0 max 9
    for(int i = 0; i < inner; i++){
      y++;
      if(z >= post){
        goto outer_loop; //Continue outer loop
      }
    }
    z++;
  }
  return (x*10000) + (y*10) + z;
}

int main(){
  int pre, inner, post;
  scanf("%d %d %d", &pre, &inner, &post);
  printf("%d\n", init_func(pre, inner, post));
}

It compiles successfully and when run with the input 1 9 1 it correctly outputs 10091. But, given the input 1 10 1 we would expect the output 10101 but get 10000. I.e. only when the second input integer is at the loop bound (10) does it execute incorrectly.

from patmos-llvm.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.