Giter VIP home page Giter VIP logo

Comments (15)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
it seems there is something wrong with pointers
i mean "*dest++ = *src++;" is not working as espected !


-------------------------------------------------------

test/21_char_array.c

int x = 'a';
char y = x;
char destarray[32];
char *a = "hello";

printf("%s\n", a);

int c;
int i;
c = *a;

char *b;
for (b = a; *b != 0; b++)
    printf("%c: %d\n", *b, *b);

char *dest = &destarray[0];
char *src = a;

i=0;
while (*src != 0)
      {
      *dest++ = *src++;
      }
*dest = 0;

printf("copied string is %s\n", destarray);

Original comment by [email protected] on 11 Sep 2009 at 9:41

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
[deleted comment]

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
[deleted comment]

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
the following is NOT working if i declare "array[17]" as char, while it is 
working if
i declare as int


int array[17];
char *src = "0123456789abcdef";

int i;

printf("msg=%s\n", src);


array[0]='c';
array[1]='i';
array[2]='a';
array[3]='o';
array[4]=0;


i=0;
while (*src != 0)
      {
      printf("step %d:   ", i);
      printf("%c ", *src);
      array[i] = *src;
      printf("[%c] ", array[i]);
      src++;
      i++;
      printf("\n");
      }
array[i]=0;

printf("phase2\n");

i=0;
while (array[i])
      {
      printf("step %d:   ", i);
      printf("[%c] ", array[i]);
      i++;
      printf("\n");




if i declare as char i get the following output

msg=0123456789abcdef
step 0:   0 [] 
step 1:   1 [] 
step 2:   2 [] 
step 3:   3 [] 
step 4:   4 [] 
step 5:   5 [] 
step 6:   6       printf("[%c] ", array[i]);
                             ^
array2.c:22: this  is not an array

Original comment by [email protected] on 12 Sep 2009 at 12:41

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
i tested picoC on x86 (little endian): test_21 has success !

we have the confirm: there is an endianless issue in the code !!!

Original comment by [email protected] on 12 Sep 2009 at 10:36

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
Hi flamemanii, I believe I've fixed this problem. Can you please test the most 
recent
version and see if it's ok now?

Original comment by [email protected] on 30 Oct 2009 at 7:43

  • Changed state: Started

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
Calling this one closed unless I hear otherwise

Original comment by [email protected] on 1 Nov 2009 at 4:53

  • Changed state: Fixed

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
it is not fixed!!!! i can't see any progress: show me the code in where there 
is no
that issue!!!

Original comment by [email protected] on 1 Nov 2009 at 6:14

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
Reopened this issue at flamemanii's request.

Hi flamemaniii, thanks for checking this for me.

What exact platform did you try this on? Which picoc version did you test?

Original comment by [email protected] on 1 Nov 2009 at 7:56

  • Changed state: Accepted

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
machine: ppc-g4,g3,450 also mips-be, hppa-be: all bigendian machines fails !

tested:
* picoc-0.92.tar.bz2
* svn checkout http://picoc.googlecode.com/svn/trunk/ picoc-read-only, Checked 
out
revision 359

is there an other version/branch?

make
cd test
tests # make
Test: 00_assignment...
Test: 01_comment...
Test: 02_printf...
Test: 03_struct...
Test: 04_for...
Test: 05_array...
Test: 06_case...
Test: 07_function...
Test: 08_while...
Test: 09_do_while...
Test: 10_pointer...
Test: 11_precedence...
Test: 12_hashdefine...
Test: 13_integer_literals...
Test: 14_if...
Test: 15_recursion...
Test: 16_nesting...
Test: 17_enum...
Test: 18_include...
Test: 19_pointer_arithmetic...
Test: 20_pointer_comparison...
Test: 21_char_array...
error in test 21_char_array
--- 21_char_array.expect        2009-10-30 22:57:15.000000000 +0100
+++ 21_char_array.output        2009-10-30 22:58:17.000000000 +0100
@@ -4,4 +4,4 @@
 l: 108
 l: 108
 o: 111
-copied string is hello
+copied string is
make: *** [21_char_array.test] Error 1


Original comment by [email protected] on 1 Nov 2009 at 10:52

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
Thanks. I don't have access to a big endian machine at the moment but I'll see 
what I
can do to find the problem.

Original comment by [email protected] on 2 Nov 2009 at 7:53

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
I finally got access to a G4 to look into this bug.

Fixed in revision #371

flamemaniii, please let me know if you still have any problems.

Original comment by [email protected] on 3 Nov 2009 at 8:45

  • Changed state: Fixed

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
i manually grabbed your #371 diff and manually patched expression.c of the last
public release picoc-0.93

well, on my ppc7410 the "Test: 21_char_array" has now success, but it seams 
there is
an issue with fixed point math


make
Test: 00_assignment...
Test: 01_comment...
Test: 02_printf...
Test: 03_struct...
Test: 04_for...
Test: 05_array...
Test: 06_case...
Test: 07_function...
Test: 08_while...
Test: 09_do_while...
Test: 10_pointer...
Test: 11_precedence...
Test: 12_hashdefine...
Test: 13_integer_literals...
Test: 14_if...
Test: 15_recursion...
Test: 16_nesting...
Test: 17_enum...
Test: 18_include...
Test: 19_pointer_arithmetic...
Test: 20_pointer_comparison...
Test: 21_char_array...
Test: 22_floating_point...
Test: 23_type_coercion...
Test: 24_math_library...
error in test 24_math_library
--- 24_math_library.expect      2009-10-30 22:57:15.000000000 +0100
+++ 24_math_library.output      2009-11-04 14:39:23.000000000 +0100
@@ -1,18 +1,18 @@
-0.119712
-0.992808
-0.120579
-0.120289
-1.450506
-0.119428
-0.120288
-1.007208
-0.119427
+-1.0
+0.715645
+-1.397340
+-2147483648.0
+-2147483648.0
+-1.570796
+2147483647.//////e-126
+2147483647.//////e-2147483648
+-1.0
 1.127496
-0.12
--2.120263
--0.920818
-0.775357
-0.346410
-12.0
-13.0
-12.0
+-0.119999
+-2147483648.0
+-2147483648.0
+0.0
+-2147483648.0
+12.84
+12.34
+12.34
make: *** [24_math_library.test] Error 1

Original comment by [email protected] on 4 Nov 2009 at 11:43

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
on HPPA1 (PA risc machine, PA7100LC, cpu family PA-RISC 1.1d)

tests # make
Test: 00_assignment...
Test: 01_comment...
Test: 02_printf...
Test: 03_struct...
Test: 04_for...
Test: 05_array...
Test: 06_case...
Test: 07_function...
Test: 08_while...
Test: 09_do_while...
Test: 10_pointer...
Test: 11_precedence...
Test: 12_hashdefine...
Test: 13_integer_literals...
Test: 14_if...
Test: 15_recursion...
Test: 16_nesting...
Test: 17_enum...
Test: 18_include...
Test: 19_pointer_arithmetic...
Test: 20_pointer_comparison...
Test: 21_char_array...
Test: 22_floating_point...
/bin/sh: line 1:  2912 Segmentation fault      ../picoc 22_floating_point.c 
2>&1 >
22_floating_point.output
make: [22_floating_point.test] Error 139 (ignored)
error in test 22_floating_point
--- 22_floating_point.expect    2009-11-04 13:02:07.000000000 +0100
+++ 22_floating_point.output    2009-11-04 13:06:24.000000000 +0100
@@ -1,16 +0,0 @@
-69.12
-69.12
--44.44
-700.6652
-0.217330
-1 1 0 0 0 1
-0 1 1 1 0 0
-0 0 0 1 1 1
-69.12
--44.44
-700.6652
-0.217330
-12.34
--12.34
-2.0
-0.909297
make: *** [22_floating_point.test] Error 1

Original comment by [email protected] on 4 Nov 2009 at 12:08

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
Moving this new bug to issue #64.

Original comment by [email protected] on 4 Nov 2009 at 6:45

from picoc.

Related Issues (20)

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.