public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20194] New: gcc-4.0.0 20050220 miscompiles Linux/ppc32 kernel at -O1 and -O2
@ 2005-02-24 18:56 mikpe at csd dot uu dot se
  2005-02-24 21:58 ` [Bug c/20194] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: mikpe at csd dot uu dot se @ 2005-02-24 18:56 UTC (permalink / raw)
  To: gcc-bugs

/* gcc4bug.c
 * Written by Mikael Pettersson <mikpe@csd.uu.se>, 2005-02-24.
 *
 * This program is abstracted from arch/ppc/mm/init.c in
 * the 2.6.11-rc4 Linux kernel sources.
 *
 * With gcc-3.4.3, gcc-3.3.5, or gcc-3.2.3, mem_init()
 * correctly returns 245.
 *
 * With gcc-4.0.0 20050220, mem_init() erroneously returns 0.
 * The error occurs with -O1, and -O2.
 * Compiling at -O0, or -O3 or higher, hides the error.
 *
 * All gcc versions were configured for powerpc-unknown-linux-gnu.
 */
#include <stdio.h>

#define PAGE_SIZE 4096
unsigned long PAGE_OFFSET;
unsigned long high_memory;
unsigned long etext;
unsigned long init_begin;
unsigned long init_end;
unsigned long klimit;

int mem_init(void)
{
        unsigned long addr;
        int codepages = 0;
        int datapages = 0;
        int initpages = 0;

        for (addr = PAGE_OFFSET; addr < high_memory; addr += PAGE_SIZE) {
                if (addr < etext)
                        codepages++;
                else if (addr >= init_begin && addr < init_end)
                        initpages++;
                else if (addr < klimit)
                        datapages++;
        }
        printf("datapages == %d, initpages == %d, codepages == %d\n", datapages,
initpages, codepages);
        return datapages;
}

int main(void)
{
    int datapages;

    PAGE_OFFSET = 0xc0000000;
    etext       = 0xc01bb958;
    init_begin  = 0xc0264000;
    init_end    = 0xc0288000;
    klimit      = 0xc02d4378;
    high_memory = 0xd0000000;
    datapages = mem_init();
    if (datapages != 245) {
        fprintf(stderr, "gcc bug! mem_init() returned %d\n", datapages);
        return 1;
    } else
        return 0;
}

-- 
           Summary: gcc-4.0.0 20050220 miscompiles Linux/ppc32 kernel at -O1
                    and -O2
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mikpe at csd dot uu dot se
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-unknown-linux-gnu
  GCC host triplet: powerpc-unknown-linux-gnu
GCC target triplet: powerpc-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20194


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/20194] gcc-4.0.0 20050220 miscompiles Linux/ppc32 kernel at -O1 and -O2
  2005-02-24 18:56 [Bug c/20194] New: gcc-4.0.0 20050220 miscompiles Linux/ppc32 kernel at -O1 and -O2 mikpe at csd dot uu dot se
@ 2005-02-24 21:58 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-24 21:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-24 17:11 -------
Even though this was filed earlier than this bug, I am closing this as a dup of bug 20196 because it has 
a shorter testcase and has identified the patch which caused it. 

*** This bug has been marked as a duplicate of 20196 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20194


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-02-24 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-24 18:56 [Bug c/20194] New: gcc-4.0.0 20050220 miscompiles Linux/ppc32 kernel at -O1 and -O2 mikpe at csd dot uu dot se
2005-02-24 21:58 ` [Bug c/20194] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).