Giter Site home page Giter Site logo

bcd / gcc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gcc-mirror/gcc

12.0 12.0 6.0 574.29 MB

A port of the gcc compiler suite to the Motorola 6809 processor

License: GNU General Public License v2.0

C 38.35% Assembly 0.70% Shell 0.63% Objective-C 0.45% C++ 16.89% Perl 0.08% Emacs Lisp 0.01% Scala 0.01% Logos 0.15% Ada 16.73% OCaml 0.07% Awk 0.01% Scilab 0.13% PHP 0.01% Haskell 0.01% Fortran 1.33% R 0.01% Java 24.47% JavaScript 0.01% CSS 0.01%

gcc's People

Contributors

bcd avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gcc's Issues

missing offset on indirect call

I have a found an issue with the code generation,
the stack offset is missing when an indirect call is made from indirect addressing mode

    ...
    ldx _icall
    stx ,s
    beq L4
    ldu _param4
    stu ,--s
    ldd _param3
    std ,--s
    ldd #2
    std ,--s
    ldx #1
    jsr [,s]
    ...

should be:

    jsr [6,s]

Here is the code (compile with -Os):

extern void memset(void *param1, int param2, int param3);

typedef int (*indcall)(int, int, int, int);

int func(int param1, int param2, int param3, int param4)
{
    return 0x5555;
}

char buf[40];
int param3 = 0x3333;
int param4 = 0x4444;
indcall icall = func;

int main(void)
{
    int var, ret = -1;
    for (var=0; var<30; var++) {
        if (icall) {
            ret = (*icall)(1, 2, param3, param4);
            if (ret)
                break;
        }
    }
    memset(buf, 0, sizeof(buf));
    return ret != 0x5555;
}

the main() never return because it jump elsewhere.

I tried to spot the bug in gcc, but without success.
(same thing happen with gcc 4.4.7)

Thank you for your help.

Must floating point be turned off?

On an Ubuntu 16.04 (which I still have to compile some other old stuff):

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.7 LTS
Release: 16.04
Codename: xenial

hein@x41:~/6809/gcc/build-6809$ uname -a
Linux x41 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:00 UTC 2021 i686 i686 i686 GNU/Linux

hein@x41:/6809/gcc/build-6809$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/5/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1
16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)

I stumble on these errors(further details below) in toplev.c:
/home/hein/6809/gcc/gcc/toplev.c:545:1: error: redefinition of ‘floor_log2’
/home/hein/6809/gcc/gcc/toplev.c:580:1: error: redefinition of ‘exact_log2’

Details:

$ make everything
.... lots of output
....

gcc -DTARGET_GCC_VERSION=4003 -O2 -fomit-frame-pointer -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/home/hein/6809/gcc/gcc -I/home/hein/6809/gcc/gcc/. -I/home/hein/6809/gcc/gcc/../include -I/home/hein/6809/gcc/gcc/../libcpp/include -I/home/hein/6809/gcc/gcc/../libdecnumber -I/home/hein/6809/gcc/gcc/../libdecnumber/dpd -I../libdecnumber
-DTARGET_NAME="m6809-unknown-none"
-c /home/hein/6809/gcc/gcc/toplev.c -o toplev.o
In file included from /home/hein/6809/gcc/gcc/toplev.c:30:0:
/home/hein/6809/gcc/gcc/tree.h: In function ‘function_args_iter_next’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/tree.h:4684:3: note: in expansion of macro ‘gcc_assert’
gcc_assert (i->next != NULL_TREE);
^
In file included from /home/hein/6809/gcc/gcc/toplev.c:30:0:
/home/hein/6809/gcc/gcc/basic-block.h: In function ‘single_succ_edge’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/basic-block.h:631:3: note: in expansion of macro ‘gcc_assert’
gcc_assert (single_succ_p (bb));
^
/home/hein/6809/gcc/gcc/basic-block.h: In function ‘single_pred_edge’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/basic-block.h:641:3: note: in expansion of macro ‘gcc_assert’
gcc_assert (single_pred_p (bb));
^
/home/hein/6809/gcc/gcc/basic-block.h: In function ‘ei_container’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/basic-block.h:673:3: note: in expansion of macro ‘gcc_assert’
gcc_assert (i.container);
^
/home/hein/6809/gcc/gcc/basic-block.h: In function ‘ei_next’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/basic-block.h:724:3: note: in expansion of macro ‘gcc_assert’
gcc_assert (i->index < EDGE_COUNT (ei_container (i)));
^
/home/hein/6809/gcc/gcc/basic-block.h: In function ‘ei_prev’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/basic-block.h:732:3: note: in expansion of macro ‘gcc_assert’
gcc_assert (i->index > 0);
^
/home/hein/6809/gcc/gcc/cgraph.h: In function ‘varpool_first_static_initializer’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/cgraph.h:393:7: note: in expansion of macro ‘gcc_assert’
gcc_assert (TREE_CODE (node->decl) == VAR_DECL);
^
/home/hein/6809/gcc/gcc/cgraph.h: In function ‘varpool_next_static_initializer’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/cgraph.h:406:7: note: in expansion of macro ‘gcc_assert’
gcc_assert (TREE_CODE (node->decl) == VAR_DECL);
^
/home/hein/6809/gcc/gcc/gcov-io.h: In function ‘gcov_position’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/gcov-io.h:588:3: note: in expansion of macro ‘gcc_assert’
gcc_assert (gcov_var.mode > 0);
^
/home/hein/6809/gcc/gcc/toplev.c: At top level:
/home/hein/6809/gcc/gcc/toplev.c:545:1: error: redefinition of ‘floor_log2’
floor_log2 (unsigned HOST_WIDE_INT x)
^
In file included from /home/hein/6809/gcc/gcc/toplev.c:58:0:
/home/hein/6809/gcc/gcc/toplev.h:177:1: note: previous definition of ‘floor_log2’ was here
floor_log2 (unsigned HOST_WIDE_INT x)
^
/home/hein/6809/gcc/gcc/toplev.c:580:1: error: redefinition of ‘exact_log2’
exact_log2 (unsigned HOST_WIDE_INT x)
^
In file included from /home/hein/6809/gcc/gcc/toplev.c:58:0:
/home/hein/6809/gcc/gcc/toplev.h:183:1: note: previous definition of ‘exact_log2’ was here
exact_log2 (unsigned HOST_WIDE_INT x)
^
In file included from /home/hein/6809/gcc/gcc/toplev.c:30:0:
/home/hein/6809/gcc/gcc/toplev.c: In function ‘push_srcloc’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/toplev.c:973:3: note: in expansion of macro ‘gcc_assert’
gcc_assert (!input_file_stack_restored);
^
/home/hein/6809/gcc/gcc/toplev.c: In function ‘pop_srcloc’:
/home/hein/6809/gcc/gcc/system.h:577:55: warning: ISO C does not support ‘FUNCTION’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (FILE, LINE, FUNCTION), 0 : 0))
^
/home/hein/6809/gcc/gcc/toplev.c:1000:3: note: in expansion of macro ‘gcc_assert’
gcc_assert (!input_file_stack_restored);
^
/home/hein/6809/gcc/gcc/toplev.c: In function ‘print_to_asm_out_file’:
/home/hein/6809/gcc/gcc/toplev.c:1259:7: warning: format not a string literal and no format arguments [-Wformat-security]
fprintf (asm_out_file, text);
^
/home/hein/6809/gcc/gcc/toplev.c: In function ‘print_to_stderr’:
/home/hein/6809/gcc/gcc/toplev.c:1288:7: warning: format not a string literal and no format arguments [-Wformat-security]
fprintf (stderr, text);
^
/home/hein/6809/gcc/gcc/toplev.c: In function ‘pch_option_mismatch’:
/home/hein/6809/gcc/gcc/toplev.c:1515:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf (&r, _("created and used with differing settings of '%s'"), option);
^
Makefile:2376: recipe for target 'toplev.o' failed
make[2]: *** [toplev.o] Error 1
make[2]: Leaving directory '/home/hein/6809/gcc/build-6809/m6809-unknown-none/gcc'
Makefile:4832: recipe for target 'install-gcc' failed
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory '/home/hein/6809/gcc/build-6809/m6809-unknown-none'
Makefile:2382: recipe for target 'install' failed
make: *** [install] Error 2
Makefile:181: recipe for target 'gccinstall' failed
make[4]: [gccinstall] Error 2 (ignored)
Installing libgcc cache...
Error: cannot open ../libgcc.a.
ls: cannot access './libgcc-cache/
.o': No such file or directory
make[4]: Leaving directory '/home/hein/6809/gcc/build-6809'
make[3]: Leaving directory '/home/hein/6809/gcc/build-6809'
make[2]: Leaving directory '/home/hein/6809/gcc/build-6809'
make[1]: Leaving directory '/home/hein/6809/gcc/build-6809'
hein@x41:~/6809/gcc/build-6809$

Any ideas? Which Linux version do you use to compile gcc6809?

Best regards,
Hans

PS: I had easy stuff with as6309 substituting comma() with comma(1)

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.