Заставь власть служить народу!

2010-02-17 Thread dmitiy . obuhov
Здравствуйте!

Ваш знакомый Обухов Д.В dmitiy.obu...@gmail.com, предлагает вам ознакомиться с 
идеей ответственности избираемых народом Президента и депутатов, смысл которой 
в следующем: поскольку единственным источником власти в России является её 
народ (ст.3 Конституции РФ), а ответственности без заранее предусмотренного 
наказания не бывает, то народ должен иметь возможность поощрять или наказывать 
избранных им руководителей государства. 

Выглядеть это должно так: каждый избиратель на очередных выборах будет  давать  
оценку деятельности Президента и членов Федерального Собрания (всех вместе, а 
не каждого депутата по отдельности, - как единого коллективного органа, 
принимающего от своего лица законы) предыдущего созыва. Оценку избиратели будут 
давать на основании собственного мнения об изменении качества своей жизни в 
период работы оцениваемых чиновников. На основании вердикта большинства 
избирателей, президент и депутаты будут: 

- поощряться, если жизнь народа улучшилась; 
- наказываться, если жизнь народа ухудшилась без объективных причин (тюремным 
заключением, на срок, не меньший срока пребывания в должности); 
- покидать свои посты без последствий для себя

Чтобы такое стало возможным, необходимо на всенародном референдуме принять 
поправку в Конституцию РФ - статью 138 и, в обеспечение ее, Закон «О суде 
народа над президентом и членами Федерального Собрания РФ». 

Если вы поддерживаете идею ответственности власти в изложенной выше форме, 
пройдите по ссылке
http://avn.armiavn.com/cgi-bin/confirm.cgi?id=0c91b66158d2a52bf6afed8b5787f0a3
Дополнительные подробности об идее и новости проекта можно узнать на сайте 
http://www.armiavn.com и в книге Ю.Мухин, О.Шенин "Практичная русская идея" 
http://avn.armiavn.com/projects/rus-idea/rus-idea_net.html

К идее уже присоединилось множество людей и их число постоянно растет.

Вместе мы добьемся появления в России ответственной власти и заставим ее 
служить народу!

Армия воли народа.

P.S. Вся деятельность Армии воли народа соответствует Конституции и законам 
России!


Re: parse tree

2010-02-17 Thread Andrew Haley
On 02/17/2010 04:50 AM, dib.cool...@gmail.com wrote:
> hi...
> I am a student of b.sc first yr in comp.science
> can you tell me 
> 
> which parsing technique is used in ANSI c language and in gcc?

A hand-written recursive descent parser.  It's in gcc/c-parse.c.

> and how the parse tree is generated in parsing phase?
> For instance if a code fragment is :
> 
> #include
> 
> 
> int main(){
> 
> int a[50],i;
> for (i=0;i<50;i++)
> 
> scanf("%d",a[i]);
> 
> for(i=0;i<50;i++)
>  printf("%d",a[i]);
> 
> return 0;
> }
> 
> 
> how C will generate his parse tree for this code?

Have a look: the source is public.

Andrew.


Re: AC_CHECK_DECLS(basename) (Was: Re: Ping: patches required for --enable-build-with-cxx)

2010-02-17 Thread Joern Rennecke

Quoting Ralf Wildenhues :

sed alternation \| is not portable.


I've replaced it now with a pair of substitutions.  I also fixed
the ',' substitution to give yield on opening bracket for the next cast,
and to apply for all commas.


+  $[]as_decl_type


What is this variable?  It doesn't seem to be defined anywhere.


Oops, that's a remnant from a previous implementation approach - I
originally intended of declaring a variable with the type of the
argument.  That might work for more cases than casting 0 to the desired
type, but supporting multiple arguments would be much messier.

Attached is the updated patch.  Bootstrapped & regtested on i686-pc-linux-gnu.
2010-02-17  Joern Rennecke  

libcpp:
* aclocal (_AC_CHECK_PROTO_BODY): New shell function.
(AC_CHECK_PROTO, _AC_CHECK_PROTOS, AC_CHECK_PROTOS): New macros.
* configure.ac: Use AC_CHECK_PROTOS instead of AC_CHECK_DECLS.
* configure: Regenerate.

Index: libcpp/configure.ac
===
--- libcpp/configure.ac (revision 156598)
+++ libcpp/configure.ac (working copy)
@@ -81,8 +81,8 @@ define(libcpp_UNLOCKED_FUNCS, clearerr_u
   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
   putchar_unlocked putc_unlocked)
 AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS)
-AC_CHECK_DECLS(m4_split(m4_normalize(abort asprintf basename errno getopt \
-  libcpp_UNLOCKED_FUNCS vasprintf)))
+AC_CHECK_PROTOS(m4_split(m4_normalize(abort asprintf basename(char*) errno \
+  getopt libcpp_UNLOCKED_FUNCS vasprintf)))
 
 # Checks for library functions.
 AC_FUNC_ALLOCA
Index: libcpp/aclocal.m4
===
--- libcpp/aclocal.m4   (revision 156598)
+++ libcpp/aclocal.m4   (working copy)
@@ -22,3 +22,74 @@ m4_include([../config/lib-link.m4])
 m4_include([../config/lib-prefix.m4])
 m4_include([../config/override.m4])
 m4_include([../config/warnings.m4])
+
+##  ##
+## Checking for declared symbols.   ##
+## This is like *AC_CHECK_DECL*, except that for c++, we may use a  ##
+## prototype to check for a (possibly overloaded) function. ##
+##  ##
+
+
+# _AC_CHECK_PROTO_BODY
+# ---
+# Shell function body for AC_CHECK_PROTO.
+m4_define([_AC_CHECK_PROTO_BODY],
+[  AS_LINENO_PUSH([$[]1])
+  [as_decl_name=`echo $][2|sed 's/(.*//'`]
+  [as_decl_use=`echo $][2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`]
+  AC_CACHE_CHECK([whether $as_decl_name is declared], [$[]3],
+  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]4],
+...@%:@ifndef $[]as_decl_name
+...@%:@ifdef __cplusplus
+  (void) $[]as_decl_use;
+...@%:@else
+  (void) $[]as_decl_name;
+...@%:@endif
+...@%:@endif
+])],
+  [AS_VAR_SET([$[]3], [yes])],
+  [AS_VAR_SET([$[]3], [no])])])
+  AS_LINENO_POP
+])# _AC_CHECK_PROTO_BODY
+
+# AC_CHECK_PROTO(SYMBOL,
+#   [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+#   [INCLUDES = DEFAULT-INCLUDES])
+# ---
+# Check whether SYMBOL (a function, variable, or constant) is declared.
+AC_DEFUN([AC_CHECK_PROTO],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_proto],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_proto],
+[LINENO SYMBOL VAR],
+[Tests whether SYMBOL is declared, setting cache variable VAR 
accordingly.])],
+  [_$0_BODY])]dnl
+[AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])]dnl
+[ac_fn_[]_AC_LANG_ABBREV[]_check_proto ]dnl
+["$LINENO" "$1" "ac_Symbol" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
+AS_VAR_IF([ac_Symbol], [yes], [$2], [$3])
+AS_VAR_POPDEF([ac_Symbol])dnl
+])# AC_CHECK_PROTO
+
+
+# _AC_CHECK_PROTOS(SYMBOL, ACTION-IF_FOUND, ACTION-IF-NOT-FOUND,
+#  INCLUDES)
+# -
+# Helper to AC_CHECK_PROTOS, which generates the check for a single
+# SYMBOL with INCLUDES, performs the AC_DEFINE, then expands
+# ACTION-IF-FOUND or ACTION-IF-NOT-FOUND.
+m4_define([_AC_CHECK_PROTOS],
+[AC_CHECK_PROTO([$1], [ac_have_decl=1], [ac_have_decl=0], [$4])]dnl
+[AC_DEFINE_UNQUOTED(AS_TR_CPP(patsubst(HAVE_DECL_[$1],[(.*])), [$ac_have_decl],
+  [Define to 1 if you have the declaration of `$1',
+   and to 0 if you don't.])]dnl
+[m4_ifvaln([$2$3], [AS_IF([test $ac_have_decl = 1], [$2], [$3])])])
+
+# AC_CHECK_PROTOS(SYMBOLS,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+# [INCLUDES = DEFAULT-INCLUDES])
+# 
+# Defines HAVE_DECL_SYMBOL to 1 if declared, 0 otherwise.  See the
+# documentation for a detailed explanation of this difference with
+# other AC_CHECK_*S macros.  SYMBOLS is an m4 list.
+AC_DEFUN([AC_CHECK_PROTOS],
+[m4_map_args_sep([_$0(], [, [$2], [$3], [$4])], [], $1)])


Re: AC_CHECK_DECLS(basename) (Was: Re: Ping: patches required for --enable-build-with-cxx)

2010-02-17 Thread Paolo Bonzini

On 02/17/2010 04:41 PM, Joern Rennecke wrote:

Quoting Ralf Wildenhues :

sed alternation \| is not portable.


I've replaced it now with a pair of substitutions. I also fixed
the ',' substitution to give yield on opening bracket for the next cast,
and to apply for all commas.


+ $[]as_decl_type


What is this variable? It doesn't seem to be defined anywhere.


Oops, that's a remnant from a previous implementation approach - I
originally intended of declaring a variable with the type of the
argument. That might work for more cases than casting 0 to the desired
type, but supporting multiple arguments would be much messier.


Maybe we can use this in AC_CHECK_DECLS instead of having a new separate 
macro.  If there is a parenthesis in the name call the new version, if 
there is none, call the old one.


If it is fine, I can do the patch using Joern's work; thanks for it.

Paolo


Re: AC_CHECK_DECLS(basename) (Was: Re: Ping: patches required for --enable-build-with-cxx)

2010-02-17 Thread Joern Rennecke

Quoting Paolo Bonzini :

Maybe we can use this in AC_CHECK_DECLS instead of having a new
separate macro.  If there is a parenthesis in the name call the new
version, if there is none, call the old one.


You shouldn't need to keep the old version around, it's supposed to be
a drop-in replacement.  The reason I used a new name was that I'm not
sure if GCC project can wait till we have a suitable macro in autoconf.

Even if you put it now into the autoconf codebase, GCC would presumably
have to wait for some time after the next release to use it.



What's the policy for bug priorities, again

2010-02-17 Thread Steven Bosscher
Hi,

Mark just made an ICE in the compiler with non-default options a P1
bug for GCC 4.5 (xf.
http://gcc.gnu.org/ml/gcc-bugs/2010-02/msg01695.html).

Can someone please explain why this kind of bug should be of
release-blocking priority?

Thanks,

Ciao!
Steven


Re: What's the policy for bug priorities, again

2010-02-17 Thread Mark Mitchell
Steven Bosscher wrote:

> Mark just made an ICE in the compiler with non-default options a P1
> bug for GCC 4.5 (xf.
> http://gcc.gnu.org/ml/gcc-bugs/2010-02/msg01695.html).
> 
> Can someone please explain why this kind of bug should be of
> release-blocking priority?

As I wrote in the PR, I want to understand what kind of "broken" applies
to this pass.  To be clear, I have no idea whether the pass is perfect,
totally wrong, or just a bit buggy.  I'm not casting any aspersions
whatsoever.  I'm responding to your comment in the PR that the patch is
broken.

Shipping a compiler with an option that we know is just a piece of junk
is a bad idea.  It's one to ship an experimental option, or a
"technology preview"; it's another to ship something that's no good to
anybody.  As a responsible software distributor, we should disable such
things in our releases.  GCC *developers* can always hack the source if
they want to play with the feature, but GCC *users* shouldn't look at
the manual, turn on some option that we know doesn't work, and then have
the compiler blow up.

I consider it P1 to understand what the situation is here.  That doesn't
mean we should fix the ICE.  The right outcome might be to disable the
pass, or to do nothing at all.

-- 
Mark Mitchell
CodeSourcery
m...@codesourcery.com
(650) 331-3385 x713


Segfault inserting a pass

2010-02-17 Thread Saleel Kudchadker
Hi I am working on calling the instrument function before every
function call automatically. I tried inserting this pass which would
add my function to every edge

//

static unsigned int spmm_insert(void){


  struct cgraph_edge *e;
  struct cgraph_node *node = cgraph_node (current_function_decl);

tree x, bind,spmm_type,spmm_decl,ctr_ptr;
x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER];
x = build_call_expr (x, 0);

 for (e = node->callees; e; e = e->next_callee){
bsi_insert_on_edge(e, x);
}


/***/

This throws me a Segfault error when compiling the code. i am applying
this pass before pass_apply_inline in passes.c
I am new to GCC, Can someone hint me documents or materials I can look
upon to insert this pass.


-- 
Regards,

Saleel Kudchadker
Graduate Student
School of Computing , Informatics and Decision Systems
Arizona State University


Re: What's the policy for bug priorities, again

2010-02-17 Thread Richard Guenther
On Wed, Feb 17, 2010 at 7:46 PM, Mark Mitchell  wrote:
> Steven Bosscher wrote:
>
>> Mark just made an ICE in the compiler with non-default options a P1
>> bug for GCC 4.5 (xf.
>> http://gcc.gnu.org/ml/gcc-bugs/2010-02/msg01695.html).
>>
>> Can someone please explain why this kind of bug should be of
>> release-blocking priority?
>
> As I wrote in the PR, I want to understand what kind of "broken" applies
> to this pass.  To be clear, I have no idea whether the pass is perfect,
> totally wrong, or just a bit buggy.  I'm not casting any aspersions
> whatsoever.  I'm responding to your comment in the PR that the patch is
> broken.
>
> Shipping a compiler with an option that we know is just a piece of junk
> is a bad idea.  It's one to ship an experimental option, or a
> "technology preview"; it's another to ship something that's no good to
> anybody.  As a responsible software distributor, we should disable such
> things in our releases.  GCC *developers* can always hack the source if
> they want to play with the feature, but GCC *users* shouldn't look at
> the manual, turn on some option that we know doesn't work, and then have
> the compiler blow up.
>
> I consider it P1 to understand what the situation is here.  That doesn't
> mean we should fix the ICE.  The right outcome might be to disable the
> pass, or to do nothing at all.

I agree.  Note that all regressions from 4.4 that are visible with release
checking and valid input should be considered P1 first - we can decide
to downgrade them later anyway, but it's good to get those top on
the radar.

Richard.

> --
> Mark Mitchell
> CodeSourcery
> m...@codesourcery.com
> (650) 331-3385 x713
>


Re: Segfault inserting a pass

2010-02-17 Thread Richard Guenther
On Wed, Feb 17, 2010 at 8:00 PM, Saleel Kudchadker  wrote:
> Hi I am working on calling the instrument function before every
> function call automatically. I tried inserting this pass which would
> add my function to every edge
>
> //
>
> static unsigned int spmm_insert(void){
>
>
>  struct cgraph_edge *e;
>  struct cgraph_node *node = cgraph_node (current_function_decl);
>
> tree x, bind,spmm_type,spmm_decl,ctr_ptr;
> x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER];
> x = build_call_expr (x, 0);
>
>  for (e = node->callees; e; e = e->next_callee){
> bsi_insert_on_edge(e, x);
> }

e is a callgraph edge, not an edge in the CFG - that doesn't work and
warnings when compiling the code would have shown that to you.

Richard.

>
> /***/
>
> This throws me a Segfault error when compiling the code. i am applying
> this pass before pass_apply_inline in passes.c
> I am new to GCC, Can someone hint me documents or materials I can look
> upon to insert this pass.
>
>
> --
> Regards,
>
> Saleel Kudchadker
> Graduate Student
> School of Computing , Informatics and Decision Systems
> Arizona State University
>


Re: AC_CHECK_DECLS(basename) (Was: Re: Ping: patches required for --enable-build-with-cxx)

2010-02-17 Thread Paolo Bonzini
>> Maybe we can use this in AC_CHECK_DECLS instead of having a new
>> separate macro.  If there is a parenthesis in the name call the new
>> version, if there is none, call the old one.
>
> You shouldn't need to keep the old version around, it's supposed to be
> a drop-in replacement.  The reason I used a new name was that I'm not
> sure if GCC project can wait till we have a suitable macro in autoconf.

Yes, I saw that now in the libcpp part of your patch.  That's even better!

> Even if you put it now into the autoconf codebase, GCC would presumably
> have to wait for some time after the next release to use it.

We have a mechanism for importing code from newer Autoconf versions
(in config/override.m4).

Paolo


Re: AC_CHECK_DECLS(basename) (Was: Re: Ping: patches required for --enable-build-with-cxx)

2010-02-17 Thread Joern Rennecke

Quoting Paolo Bonzini :


Maybe we can use this in AC_CHECK_DECLS instead of having a new
separate macro.  If there is a parenthesis in the name call the new
version, if there is none, call the old one.


You shouldn't need to keep the old version around, it's supposed to be
a drop-in replacement.  The reason I used a new name was that I'm not
sure if GCC project can wait till we have a suitable macro in autoconf.


Yes, I saw that now in the libcpp part of your patch.  That's even better!


I've attached the patch against autoconf 2.64.
2010-02-18  Joern Rennecke  

* general.m4 (_AC_CHECK_DECL_BODY): Process trailing function
argument types as arguments to use for C++.
(_AC_CHECK_DECLS): Filter out trailing function argument types
when henerating the HAVE_DECL_* macro.

--- autoconf-2.64/share/autoconf/autoconf/general.m42010-01-19 
12:26:54.937745483 +
+++ /home/amylaar/general.m4-pr427982010-02-18 00:50:52.084941182 +
@@ -2806,10 +2806,16 @@ AC_DEFUN([AC_CHECK_FILES],
 # Shell function body for AC_CHECK_DECL.
 m4_define([_AC_CHECK_DECL_BODY],
 [  AS_LINENO_PUSH([$[]1])
-  AC_CACHE_CHECK([whether $[]2 is declared], [$[]3],
+  [as_decl_name=`echo $][2|sed 's/(.*//'`]
+  [as_decl_use=`echo $][2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`]
+  AC_CACHE_CHECK([whether $as_decl_name is declared], [$[]3],
   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]4],
-...@%:@ifndef $[]2
-  (void) $[]2;
+...@%:@ifndef $[]as_decl_name
+...@%:@ifdef __cplusplus
+  (void) $[]as_decl_use;
+...@%:@else
+  (void) $[]as_decl_name;
+...@%:@endif
 @%:@endif
 ])],
   [AS_VAR_SET([$[]3], [yes])],
@@ -2844,7 +2850,7 @@ AS_VAR_POPDEF([ac_Symbol])dnl
 # ACTION-IF-FOUND or ACTION-IF-NOT-FOUND.
 m4_define([_AC_CHECK_DECLS],
 [AC_CHECK_DECL([$1], [ac_have_decl=1], [ac_have_decl=0], [$4])]dnl
-[AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_DECL_$1]), [$ac_have_decl],
+[AC_DEFINE_UNQUOTED(AS_TR_CPP(patsubst(HAVE_DECL_[$1],[(.*])), [$ac_have_decl],
   [Define to 1 if you have the declaration of `$1',
and to 0 if you don't.])]dnl
 [m4_ifvaln([$2$3], [AS_IF([test $ac_have_decl = 1], [$2], [$3])])])


No integral promotions when calling library function?

2010-02-17 Thread Jie Zhang
We are trying to add a 16bit integer division library function for
bfin port. I just found GCC didn't do integral promotions when calling
library function.

For example, in function foo, I can assume both arguments are zero
extended from unsigned short to unsigned int.

extern unsigned short foo (unsigned short, unsigned short);
unsigned int a;
unsigned int b;
unsigned short bar ()
{
return foo ((unsigned short) a, (unsigned short) b);
}

But with the following code, I can't assume that the high halves of R0
and R1, which are the first two registers for argument passing, are
all zeros.

unsigned int a;
unsigned int b;
unsigned short bar ()
{
return (unsigned short) a / (unsigned short) b;
}

Is this expected?

Thanks,
Jie