Code Monkey home page Code Monkey logo

gcc-6502-bits's People

Contributors

ccureau avatar claus64 avatar itszor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gcc-6502-bits's Issues

Rebase to GCC 6/code generation improvements

There's incomplete work in the m65x-gcc-virt branch of the gcc-6502 repo. Results so far look promising, though there are still some unresolved codegen bugs relative to the version currently tagged from this repo.

static variables placed in the wrong segment

Steps to reproduce

static int a[100];

int f(int i, int v) {
    a[i] = v;
    return *a;
}

Compile with 6502-gcc sample.c -O0 -S -o sample.s

Expected behavior

Memory for the a variable is reserved in BSS segment.

Actual behavior

Memory for the a variable is reserved in CODE segment.

    .feature at_in_identifiers
    .feature dollar_in_identifiers
    .autoimport +
    .p02
    .importzp _sp0, _sp1, _fp0, _fp1
    .importzp _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7
    .importzp _s0, _s1, _s2, _s3, _s4, _s5, _s6, _s7
    .importzp _e0, _e1, _e2, _e3, _e4, _e5, _e6, _e7
    .importzp _e8, _e9, _e10, _e11, _e12, _e13, _e14, _e15
    .importzp _e16, _e17, _e18, _e19, _e20, _e21, _e22, _e23
    .importzp _e24, _e25, _e26, _e27, _e28, _e29, _e30, _e31
    .importzp _tmp0, _tmp1
    .importzp _sa, _sx, _sy
    .segment "CODE"
a$:
    .res 200
    .export f$
f$:
; frame size 4, pretend size 0, outgoing size 0
    lda _sp1
    pha
    lda _sp0
    pha
    [...]

Additional information

Commit 67a23d5 is applied. Without it the same behavior was also observed on non-static variables.

The faulty behavior is also observable if a is declared in the function:

int f(int i, int v) {
    static int a[100];
    a[i] = v;
    return *a;
}

vfprintf.c in tiny C Library fails to compile

On stage 2 the build fails with

***************************
* Building tiny C library *
***************************

.: compile: exit.c
.: compile: abort.c
.: compile: stdfiles.c
.: compile: semi65x/fputc.c
.: compile: fputs.c
.: compile: putchar.c
.: compile: puts.c
.: compile: vfprintf.c
vfprintf.c: In function 'print_udec':
vfprintf.c:36:1: internal compiler error: Max. number of generated reload insns per insn is achieved (90)

 }
  ^
0x83865b lra_constraints(bool)
	../../gcc-src/gcc/lra-constraints.c:4831
0x81e34b lra(_IO_FILE*)
	../../gcc-src/gcc/lra.c:2335
0x7b70f7 do_reload
	../../gcc-src/gcc/ira.c:5417
0x7b75df execute
	../../gcc-src/gcc/ira.c:5588

I have done a fresh install of Ubuntu 17 on x86_64 and installed cc65 as both packages and afrom source.

$ gcc --version
gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406

I have also tried an ARM build on Raspberry Pi from source and that fails with the same error.

pi@raspberrypi ~/code/code/gcc-6502-bits $ gcc --version
gcc (Debian 4.6.3-14+rpi1) 4.6.3

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.