Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Kaz Kylheku <330-706-9395@kylheku.com> Newsgroups: comp.compilers Subject: Re: warning: assignment makes pointer from integer without a cast[enabled by default] yylval=atoi(yytext); Date: Wed, 24 Feb 2016 15:56:17 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 22 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <16-02-006@comp.compilers> References: <16-02-003@comp.compilers> Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="55477"; mail-complaints-to="abuse@iecc.com" Keywords: yacc, debug Posted-Date: 24 Feb 2016 23:54:39 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1669 On 2016-02-22, Danny Pereira wrote: > *purelex.l:12:8: warning: assignment makes pointer from integer without a > cast [enabled by default] yylval=atoi(yytext); * This tells you that yylval does not have type int as you expect; it is in fact a pointer to something. Though presented as a "warning" in GCC, assigning an integer to a pointer is a constraint violation according to ISO C, requiring a diagnostic from a conforming implementation, and the behavior is not well defined if the code is translated and executed anyway. It is a bad idea to ignore this diagnostic. Your yylval is a pointer because of the "Bison bridge" option. This is documented in the GNU Flex manual: A.2 C Scanners with Bison Parsers [... few paragraphs down ...] Note that the macros `yylval' and `yylloc' evaluate to pointers.