Re: Weird result for modulus operation

2008-04-30 Thread Ang Way Chuang

Paolo Bonzini wrote:

Ang Way Chuang wrote:

Ang Way Chuang wrote:

Andrew Pinski wrote:

On Tue, Apr 29, 2008 at 9:08 PM, Ang Way Chuang <[EMAIL PROTECTED]> wrote:

 Thanks for the speedy reply. But why this code:

int a = 17, b = 16;
a = a++ % 16;

 results in a = 2 then? I think I need to know what is sequence 
point. I'll

google that.


As I mentioned, the code is undefined so it could be any value.


Is there any flag in gcc that can provide warning to code that relies 
on undefined behaviours?


Found it. -Wsequence-point which is enabled by -Wall. But gcc didn't 
fart out any warning with -Wall or -Wsequence-point flag :(


You found a bug, it does point out the problem with the second example 
here.


Huh? Now you got me confused. Since it is an undefined behaviour, gcc is 
free to whatever it likes. Though the answer given by the first and 
second examples show inconsistency in gcc in handling the undefined 
behaviour. I can't forward to gmane.comp.gcc.devel newsgroup with my 
account.




Paolo





Re: Weird result for modulus operation

2008-04-30 Thread Paolo Bonzini

 Thanks for the speedy reply. But why this code:

int a = 17, b = 16;
a = a++ % 16;


Huh? Now you got me confused. Since it is an undefined behaviour, gcc is 
free to whatever it likes.


Sure, but if you ask gcc to signal a warning, it is supposed to do so. 
:-)  It is a bug that gcc with -Wsequence-point signals a warning for "a 
= a++ % 16" but not when you use abc.a.


Though the answer given by the first and 
second examples show inconsistency in gcc in handling the undefined 
behaviour.


That's not a problem.  GCC does not have to be consistent.  But both 
should be warned about.


I can't forward to gmane.comp.gcc.devel newsgroup with my 
account.


No problem, you can delete it.

Paolo


Re: Weird result for modulus operation

2008-04-30 Thread Ang Way Chuang

Paolo Bonzini wrote:

 Thanks for the speedy reply. But why this code:

int a = 17, b = 16;
a = a++ % 16;


Huh? Now you got me confused. Since it is an undefined behaviour, gcc 
is free to whatever it likes.


Sure, but if you ask gcc to signal a warning, it is supposed to do so. 
:-)  It is a bug that gcc with -Wsequence-point signals a warning for "a 
= a++ % 16" but not when you use abc.a.




Oic, thank you for the clarification. I didn't notice that the warning 
works for a = a++ % 16 because I only tried the -Wsequence-point flag on 
abc.a example.


Though the answer given by the first and second examples show 
inconsistency in gcc in handling the undefined behaviour.


That's not a problem.  GCC does not have to be consistent.  But both 
should be warned about.



I can't forward to gmane.comp.gcc.devel newsgroup with my account.


No problem, you can delete it.

Paolo





Re: Some questions about writing a front end

2008-04-30 Thread Tim Josling
On Thu, 2008-04-17 at 10:24 -0700, Ian Lance Taylor wrote:
> Tim Josling <[EMAIL PROTECTED]> writes:

> > 5. What is deprecated: Is there any time-effective way to identify
> > constructs, header files, macros, variable and functions that are
> > "deprecated".
> 
> Not really.  We try not to leave deprecated stuff around for too long.
> 

Good, but I was wondering then what I should avoid so that my front-end
avoids being "not a very good example" (like treelang).

Tim Josling



Re: Weird result for modulus operation

2008-04-30 Thread Robert Dewar

Ang Way Chuang wrote:

Andrew Pinski wrote:

On Tue, Apr 29, 2008 at 8:50 PM, Ang Way Chuang <[EMAIL PROTECTED]> wrote:


abc.a = abc.a++ % abc.b;

You are assigning to abc.a twice without a sequence point inbetween so
this code is undefined as the order of evaluation of expressions
without a sequence point is unspecified.

Thanks for the speedy reply. But why this code:

int a = 17, b = 16;
a = a++ % 16;

results in a = 2 then? I think I need to know what is sequence point. 
I'll google that.


undefined means undefined, you can't expect two
similar undefined constructs to have anaologous
behavior!

Thanks,
Andrew Pinski





Test Coverage not on whole execution (gcov)

2008-04-30 Thread Fabien Baron
Hello,

I'm working on a big project in C code, and I want to profile it so I
used gcc with the options -ftest-coverage and -fprofile-arcs, and gcov
to analyze the results. It works very well but on the whole project
and the whole execution !!
My question is :
Is it possible to start and stop profiling/coverage during the program
execution ? If it is how I can do that ?

I'm working with cygwin !


Thank you for your answer 

PS. Sorry if it is not the right place to ask that question !

Fabien [FR]


Re: [switch conv] Bootsrap error because of the (CERT) pointer wraparound warning

2008-04-30 Thread Martin Jambor
On Mon, Apr 28, 2008 at 05:59:54PM -0700, Ian Lance Taylor wrote:
> 
> The warnings I added for the CERT advisory say "assuming pointer
> wraparound does not occur"  You are running into one of the older
> signed overflow warnings.
> 

Oh, sorry for that oversight.  It has started happening (when testing
exactly the same  code) shortly after the CERT patch got  in and so I
got misled.

> 
> Make branch_num an unsigned int.
> 

That did it.

Thank you,

Martin


Re: Some questions about writing a front end

2008-04-30 Thread Ian Lance Taylor
Tim Josling <[EMAIL PROTECTED]> writes:

> On Thu, 2008-04-17 at 10:24 -0700, Ian Lance Taylor wrote:
>> Tim Josling <[EMAIL PROTECTED]> writes:
>
>> > 5. What is deprecated: Is there any time-effective way to identify
>> > constructs, header files, macros, variable and functions that are
>> > "deprecated".
>> 
>> Not really.  We try not to leave deprecated stuff around for too long.
>> 
>
> Good, but I was wondering then what I should avoid so that my front-end
> avoids being "not a very good example" (like treelang).

Keep maintaining it.  Treelang never changed.

Ian


Re: [RFC] Modeling the behavior of function calls

2008-04-30 Thread Marc Glisse

On Mon, 28 Apr 2008, Diego Novillo wrote:


 We have been bouncing ideas for a new mechanism to describe the behavior
 of function calls so that optimizers can be more aggressive at call
 sites.  Currently, GCC supports the notion of pure/impure,
 const/non-const, but that is not enough for various cases.

 The main application for this would be stable library code like libc,
 that the compiler generally doesn't get to process.

 David sketched up the initial idea and we have been adding to it for the
 last few weeks.  At this point, we have the initial design ideas and
 some thoughts on how we would implement it, but we have not started any
 actual implementation work.

 The main idea is to add a variety of attributes to describe contracts
 for function calls.  When the optimizers read in the function
 declaration, they can take advantage of the attributes and adjust the
 clobbering effects of call sites.

 We are interested in feedback on the main idea and possible
 implementation effort.


Nice.

The last time I thought about something like this was for automatic 
parallelization. In order to be allowed to automatically add openmp 
directives to a loop, you need to determine that what is done in the loop 
is safe to parallelize. There are some cases where things are obvious with 
calls to pure/const functions. However, I was particularly interested in 
the case where the loop may use functions which call malloc and thus 
cannot be declared pure/const (I believe), although they should be safe to 
parallelize (assuming your malloc is thread-safe).


I don't think I have seen in your proposal any attributes that would help 
in this case, but I may have overlooked some. Note that I don't know what 
exact contracts on functions would be most useful for this. It could be 
considered an independent project, but I guess that if people have to 
manually go through the code to add attributes, it would be better if the 
list was as complete as possible (even if some attributes are ignored for 
now) to start with so they don't have to go through the code again later 
when we add yet another attribute.


--
Marc Glisse


Should we update __builtin_ia32_palignr?

2008-04-30 Thread H.J. Lu
Hi,

We currently define __builtin_ia32_palignr as

long long __builtin_ia32_palignr (long long, long long, int)

But it really should be

v1di __builtin_ia32_palignr (v1di, v1di, int)

Fix it won't affect sources which use intrinsics defined
in tmmintrin.h. But it may affect codes which use
__builtin_ia32_palignr directly. But I don't think there
are many users who use MMX version of gcc SSSE3
builtins directly. Should I submit a patch to change it?

Thanks.


H.J.


gcc-4.2-20080430 is now available

2008-04-30 Thread gccadmin
Snapshot gcc-4.2-20080430 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.2-20080430/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 4.2 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_2-branch 
revision 134839

You'll find:

gcc-4.2-20080430.tar.bz2  Complete GCC (includes all of below)

gcc-core-4.2-20080430.tar.bz2 C front end and core compiler

gcc-ada-4.2-20080430.tar.bz2  Ada front end and runtime

gcc-fortran-4.2-20080430.tar.bz2  Fortran front end and runtime

gcc-g++-4.2-20080430.tar.bz2  C++ front end and runtime

gcc-java-4.2-20080430.tar.bz2 Java front end and runtime

gcc-objc-4.2-20080430.tar.bz2 Objective-C front end and runtime

gcc-testsuite-4.2-20080430.tar.bz2The GCC testsuite

Diffs from 4.2-20080423 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-4.2
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


solaris is a secondary platform for gcc-4.4

2008-04-30 Thread Benjamin Kosnik

Given that the set of posted solaris test results for trunk during the
last four months barely requires two hands:

2008-01
http://gcc.gnu.org/ml/gcc-testresults/2008-01/msg01474.html
http://gcc.gnu.org/ml/gcc-testresults/2008-01/msg01460.html
http://gcc.gnu.org/ml/gcc-testresults/2008-01/msg01460.html

2008-02
http://gcc.gnu.org/ml/gcc-testresults/2008-02/msg01519.html

2008-03
http://gcc.gnu.org/ml/gcc-testresults/2008-03/msg01093.html
http://gcc.gnu.org/ml/gcc-testresults/2008-03/msg00363.html

2008-04
(none)

I propose moving

sparc-sun-solaris2.10

from primary to secondary on this page:

http://gcc.gnu.org/gcc-4.4/criteria.html

Thoughts?

-benjamin


Re: libstdc++ svn head broken

2008-04-30 Thread NightStrike
Indeed, thanks!

What was the issue?

On Tue, Apr 29, 2008 at 6:27 PM, Benjamin Kosnik <[EMAIL PROTECTED]> wrote:
>
>  > Doing a build of gcc from revision 134693 with
>
>  The build issue should be fixed post 134776.
>
>  -benjamin
>


Re: solaris is a secondary platform for gcc-4.4

2008-04-30 Thread Dennis Clarke
On Thu, May 1, 2008 at 3:17 AM, Benjamin Kosnik <[EMAIL PROTECTED]> wrote:
>
>  Given that the set of posted solaris test results for trunk during the
>  last four months barely requires two hands:
>
>  2008-01
>  http://gcc.gnu.org/ml/gcc-testresults/2008-01/msg01474.html
>  http://gcc.gnu.org/ml/gcc-testresults/2008-01/msg01460.html
>  http://gcc.gnu.org/ml/gcc-testresults/2008-01/msg01460.html
>
>  2008-02
>  http://gcc.gnu.org/ml/gcc-testresults/2008-02/msg01519.html
>
>  2008-03
>  http://gcc.gnu.org/ml/gcc-testresults/2008-03/msg01093.html
>  http://gcc.gnu.org/ml/gcc-testresults/2008-03/msg00363.html
>
>  2008-04
>  (none)
>
>  I propose moving
>
>  sparc-sun-solaris2.10
>
>  from primary to secondary on this page:
>
>  http://gcc.gnu.org/gcc-4.4/criteria.html
>
>  Thoughts?

Hardly reasonable.

This may not be a surprise to you but people in datacenters with
Solaris servers tend to move very slowly and cautiously when it comes
to software changes.

You will get testsuite reports when people get to it. Not before. The
userbase for Solaris 8 upwards is quite well established and very
tier-1 level. Not to be ignored.

Dennis