this is probably general gcc issue.
For example, I got lots of such warnings in my project cause gcc combines some
code.
... but 'case' pattern is still a subject to be worked out.
~d
On Monday 16 December 2002 17:15, David Brown wrote:
> I like to make use of most of the warnings gcc can provide - they can often
> give a good indication of small mistakes in the code (trapping things like
> if (x = 1) ... and other common mistakes). The -Wunreachable-code is
> particularly useful. However, this seems to work badly with optomisation.
> In the code:
>
> int a, b;
>
> void t2(void) {
> switch (a) {
> case 1 : b = 1; break;
> case 2 : b = 2; break;
> case 3 : b = 1; break;
> };
> }
>
> When optomisation is turned on (-O or above), only one "b = 1" statement is
> actually generated, and the code jumps there for either case 1 or case 3.
> This is, of course, good optomisation, and is particularly useful for more
> complex cases. However, the compiler gives a "warning: will never be
> executed" warning on the line "case 1..." . The duplicate code has been
> eliminated, but the line itself will still be executed - the warning here
> is incorrect. Is this an mspgcc issue, or a general gcc issue? The
> generated code works perfectly, whether compiled with optomisation or not,
> but it would be nice to avoid incorrect warnings, while keeping the
> warnings when they really are valid.
>
> mvh.
>
> David
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:
> With Great Power, Comes Great Responsibility
> Learn to use your power at OSDN's High Performance Computing Channel
> http://hpc.devchannel.org/
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
/********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314
********************************************************************/