From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98062 invoked by alias); 2 Mar 2016 08:36:27 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 98025 invoked by uid 89); 2 Mar 2016 08:36:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Max, H*UA:6.3, H*F:D*gmx.de, HX-Provags-ID:V03 X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.15.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Mar 2016 08:36:24 +0000 Received: from [10.2.2.142] ([109.199.162.209]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0Mb7lL-1aLRE13Cbz-00Kiek; Wed, 02 Mar 2016 09:36:18 +0100 To: ecos-discuss@ecos.sourceware.org, =?UTF-8?Q?Max_Seidenst=c3=bccker?= From: Privat X-Enigmail-Draft-Status: N1110 Message-ID: <56D6A602.10908@gmx.de> Date: Wed, 02 Mar 2016 08:36:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-UI-Out-Filterresults: notjunk:1;V01:K0:Wh/uGGQqOSQ=:AsRqVGkJoj6Z3DjuE8A2Rm NehVrRVVMH69t5/5iKqsiUJpJJVUDmkrG22EHq6AMPlyWutUILoQWXPsppxWWOK6gjcmfv5oK PKVpcliJnInnMRhKIZLRo+YRqHok2AdzfJ6lJ3LHaTXt15z3OTYv79+Wu4j3KBoO00znVm8j8 3TGPFcEJI7vuSARJuiMABxDu6tppkFbeRM4y2485up12aRjWd+TAaCSB5C5yPTPl9VqexBIZM 3eEFgHCwCjL0NFjDJ/4BH+1rZ9BwUVDmAeB0gvIia0kFTCTyk8f0wXTRCTGs4lWjCvRnP0DvG 2hpwiWmSpFVKI2YntCkXR7JJx1M4l63pg5Po9z3xWqPcSOC9stjkSGUkNE6UcJUzXCaKU/95F 6ZRCIRgAKHg8r3sVQFPMIVovf5Ue4X0QHQBGqBmSISS3FnDyk3FKomJw/vERQQRRL23CSnQxs 9pFxLAZSwwsxUuAVYC9Ub/QtBq/fUF2o1CGs8S2Xz32lVkhuqoEmjpXreCGpGAtd0Y1bJjsX4 6czs0xhgPCBhMFtfCuOi0/doFYgr4cWpd6fFEY7zoXRhP5mcKkyBBhFAb394HfSNli1mmgt55 aBjj+5uRaIbHNAMoWI6DggBN0s41lpzhvLoPXpu2myJNMdkxNHDDZNdLDLEsLLonBoEqhi4sh 5Jo8xkGpaMv2gP2CiAUGJbvPHlWyVucoUIYb+kZGblgWtmGPionLEgGF9dCqdduFB3oQPnsC7 4uq0teOZ0K3fb79RJRblLdJCyS1dqUH1vkZLN66sUPqKphBYcqithGXEin5fcwhR4wyCUDpig xwSz7yD X-IsSubscribed: yes Subject: [ECOS] Eabi error or Compiler Bug? X-SW-Source: 2016-03/txt/msg00002.txt.bz2 Hi Max, Hi Edwards, hi everyone i ve bumped into some strange behaviour again lately during some code cleanup. I can work around it, but i wondered if other before me ran into this and wether this is UB, a compiler bug or something ecos specific. My Compiler: Im compiling under ubuntu 14.04 for the MPC5668x powerpc architecture with ppc-eabi-gcc 4.8.2 toolchain (if i found the correct compiler there) . The problem occurs when casting pointers to a smaller size; Example: cyg_uint32 testValue = 0x12345678; cyg_uint8 *ptrToLowestByte; cyg_uint32 *ptrToWholeValue; ptrToLowestByte = (cyg_uint8 *) (&testValue); ptrToWholeValue = (cyg_uint32 *) ptrToLowestByte; I can work with the ptrToTheWholeValue as long i do not use any binary operations with a diffrent size For example cyg_uint32 container32 = ((*ptrToWholeValue) & 0xFF00 0000) will return valid Value into the corresponding 32uint container; cyg_uint8 container8 = (cyg_uint8) ((ptrToWholeValue & 0xFF00 0000 ) >> 24); However will not. My assumption is that the endianess of the dereferenced Value is wrong, a cast pointer does no longer point to the lowest byte, but to the highest instead. I worked around it by not using bitops that shift into a diffrently sized variable from a pointer. If requested i could upload some dissasembly. I also experienced some problems using memcpy and strncpy, when using casted down uint8* ptr to uint8 arrays - where the values to copy where copyied in at a offset off the original ptrs data type (uint32*). This all may be perfectly normal behaviour and i m just lacking experience- in that case i would be very glad for any explenation. Anybody experienced something similar? There seem to be some todos regarding assembly binary operations in the vle.h still open. Should i report this to the gnu or will i get trampled by a stampede? Regards Pica -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss