From c1fe41cbd37fca7d9079cc7fce669c68ac294c99 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Fri, 6 Jan 1995 18:17:39 -0800 Subject: (DO_GLOBAL_CTORS_BODY): Run constructors from right to left not left to right. From-SVN: r8722 --- gcc/config/h8300/h8300.h | 4 ++-- gcc/config/sh/sh.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 674b0f2..494dd45 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -1037,9 +1037,9 @@ dtors_section() \ extern pfunc __ctors[]; \ extern pfunc __ctors_end[]; \ pfunc *p; \ - for (p = __ctors; p < __ctors_end; p++) \ + for (p = __ctors_end; p > __ctors; ) \ { \ - (*p)(); \ + (*--p)(); \ } \ } diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 21351b2..de39ef8 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -1292,9 +1292,9 @@ dtors_section() \ extern pfunc __ctors[]; \ extern pfunc __ctors_end[]; \ pfunc *p; \ - for (p = __ctors; p < __ctors_end; p++) \ + for (p = __ctors_end; p > __ctors; ) \ { \ - (*p)(); \ + (*--p)(); \ } \ } -- cgit v1.1