diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-14 18:18:02 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-14 18:18:02 +0000 |
commit | 02d823eb8fa25017d97ae8d228912c8cdea7d716 (patch) | |
tree | 5bc7122cdcc7876abf8b9dfc39a6bf5230211591 | |
parent | 8bc66b877b0308e2d21747789e4733460ba8c74c (diff) | |
download | gcc-02d823eb8fa25017d97ae8d228912c8cdea7d716.tar.gz |
2016-05-14 Basile Starynkevitch <basile@starynkevitch.net>
{{see http://stackoverflow.com/q/37229005/841108}}
* melt-runtime.cc (memset, memcpy): Naive implementation when #if
MELT_HAVE_OWN_STRINGS_FUNCTIONS>0...
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@236243 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog.MELT | 5 | ||||
-rw-r--r-- | gcc/melt-runtime.cc | 36 |
2 files changed, 41 insertions, 0 deletions
diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT index e688ad7a60f..eed35345110 100644 --- a/gcc/ChangeLog.MELT +++ b/gcc/ChangeLog.MELT @@ -1,4 +1,9 @@ +2016-05-14 Basile Starynkevitch <basile@starynkevitch.net> + {{see http://stackoverflow.com/q/37229005/841108}} + * melt-runtime.cc (memset, memcpy): Naive implementation when #if + MELT_HAVE_OWN_STRINGS_FUNCTIONS>0... + 2016-05-13 Basile Starynkevitch <basile@starynkevitch.net> {{still very unstable; perhaps crashing only without ASLR}} * melt-runtime.h (melt_nb_full_garbcoll, melt_nb_garbcoll): diff --git a/gcc/melt-runtime.cc b/gcc/melt-runtime.cc index 60e65ad9129..d42c19eb859 100644 --- a/gcc/melt-runtime.cc +++ b/gcc/melt-runtime.cc @@ -13409,6 +13409,42 @@ void melt_gt_ggc_mx_gimple_seq_d(void*p) #error melt_gt_ggc_mx_gimple_seq_d unimplemented for this version of GCC #endif /* GCC 6, 5 or less */ +/** +See http://stackoverflow.com/q/37229005/841108 for motivations.... +While debugging (with gdb 7.10 or 7.11), I am sometimes hit by the +https://sourceware.org/bugzilla/show_bug.cgi?id=19365 bug (or +something related, +e.g. https://bugzilla.redhat.com/show_bug.cgi?id=1136403 ...). +I am not happy to have to do the following. + **/ +#if MELT_HAVE_OWN_STRINGS_FUNCTIONS >0 +#warning MELT_HAVE_OWN_STRINGS_FUNCTIONS is activated +extern "C" const int melt_have_own_strings_functions += MELT_HAVE_OWN_STRINGS_FUNCTIONS; + +#pragma GCC optimize ("-Og") + +void *memset(void*s, int c, size_t n) throw () +{ + char*p = (char*)s; + for (long i=0; i<(long)n; i++) + p[i] = c; + return s; +} + +void* memcpy(void*dest, const void*src, size_t n) throw () +{ + char*pd = (char*)dest; + const char*ps = (const char*)src; + for (long i=0; i<(long)n; i++) + pd[i] = ps[i]; + return dest; +} + +#pragma GCC reset_options +#endif /*MELT_HAVE_OWN_STRINGS_FUNCTIONS*/ + + ///////////////// always at end of file /* For debugging purposes, used thru gdb. */ |