From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27925 invoked by alias); 14 Mar 2012 11:12:22 -0000 Received: (qmail 27913 invoked by uid 22791); 14 Mar 2012 11:12:20 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_GJ X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Mar 2012 11:12:07 +0000 From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/52474] Regression: AVR-GCC: arithmetics produce completely wrong result Date: Wed, 14 Mar 2012 11:36:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg01259.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52474 --- Comment #4 from Georg-Johann Lay 2012-03-14 11:11:47 UTC --- Created attachment 26889 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26889 main.s: FSF Assembler output Here is the assembler output of the main mudule generated with $ avr-gcc -mmcu=atmega168 -S main.c -O2 -dp If you see the same code your problem is somewhere else. If you see different code for these options, the problem comes from non-FSF changes. As indicated in comment #0 there is a call to __mulhisi3 which is not present in the attached main.s and is not part of the FSF sources, see http://gcc.gnu.org/viewcvs/branches/gcc-4_5-branch/gcc/config/avr/avr.md?content-type=text%2Fplain&view=co __mulhisi3 is present in avr-gcc 4.7 but that implementation is from scratch and does not use __mulhisi3 patches floating around. (In reply to comment #3) > OK, so talking to the debian maintainer, the GCC version I'm using is based > upon patches available here: > > http://distribute.atmel.no/tools/opensource/avr-gcc/ > > Here is a test case. I'm unsure how to make a test case for code > to be executed on a microcontroller because I need to make some > assumptions about the board so that the result can be shown to > the user somehow (flash a LED, whatever...) Please, do not make assumptions on the hardware. The more assumptions you make the more artificial barriert you build up. Just can use exit and abort from stdlib.h to indicate the problem. If you want to avoid that GCC uses knowledge on functions, you can short __attribute__((noinline,noclone)) query (void) { return 0; }