Bugs item #2535084, was opened at 2009-01-25 01:59 Message generated for change (Comment added) made by mitchell-elahi You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=616200&aid=2535084&group_id=96864
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Den Ivanov (dsdiv) Assigned to: Paul McQuesten (paulmcq) Summary: re2c 0.13.5 not compile with Sun C Initial Comment: re2c 0.13.5 not compile with Sun C compiler at Solaris 10 x64: CC -DHAVE_CONFIG_H -I. -g -c -o parser.o parser.cc "parser.y", line 98: Warning (Anachronism): Assigning std::pair<unsigned, re2c::RuleOp*> to std::pair<int, re2c::RegExp*>. "parser.y", line 98: Error: Cannot cast from std::pair<unsigned, re2c::RuleOp*> to std::pair<int, re2c::RegExp*>. 1 Error(s) and 1 Warning(s) detected. Compiler version: "Sun C 5.8 Patch 121016-07 2007/10/03" ---------------------------------------------------------------------- Comment By: Mitchell (mitchell-elahi) Date: 2012-09-07 11:52 Message: but re2c built with such fixes produces no output, just header "/* Generated by re2c 0.13.5 ... */" :) ---------------------------------------------------------------------- Comment By: Mitchell (mitchell-elahi) Date: 2012-09-07 11:42 Message: however, casting rule to RegExp (as in davidmarker's patch) and "0" to unsigned at line 585 of parser.y helps ---------------------------------------------------------------------- Comment By: Mitchell (mitchell-elahi) Date: 2012-09-07 11:28 Message: No, this fix does not help with latest Solaris Studio 12.3 source='parser.cc' object='parser.o' libtool=no \ DEPDIR=.deps depmode=none /bin/sh ./depcomp \ CC -DHAVE_CONFIG_H -I. -m64 -fast -xvector=simd -xO5 -I/opt/smbsys/include -I/opt/smbbld/include -m64 -fast -xvector=simd -xO5 -I/opt/smbsys/include -I/opt/smbbld/include -c -o parser.o parser.cc "parser.y", line 99: Warning (Anachronism): Assigning std::pair<unsigned, re2c::RuleOp*> to std::pair<unsigned, re2c::RegExp*>. "parser.y", line 99: Error: Cannot cast from std::pair<unsigned, re2c::RuleOp*> to std::pair<unsigned, re2c::RegExp*>. "parser.y", line 585: Warning (Anachronism): Assigning std::pair<int, re2c::RegExp*> to std::pair<unsigned, re2c::RegExp*>. "parser.y", line 585: Error: Cannot cast from std::pair<int, re2c::RegExp*> to std::pair<unsigned, re2c::RegExp*>. 2 Error(s) and 2 Warning(s) detected. gmake[1]: *** [parser.o] Error 2 gmake[1]: Leaving directory `/src/smbsys/re2c-0.13.5' gmake: *** [all] Error 2 $ cc -V cc: Sun C 5.12 SunOS_i386 2011/11/16 ---------------------------------------------------------------------- Comment By: Rui Maciel (rui_maciel) Date: 2011-09-26 04:14 Message: At first glance it appears that the only reason the cast is necessary in the first place is that NRegExp pairs an unsigned with RegExp. Wouldn't it be simpler and somewhat better to simply change the definition of: typedef std::pair<unsigned, RegExp*> NRegExp; to typedef std::pair<size_t, RegExp*> NRegExp; ? ---------------------------------------------------------------------- Comment By: Paul McQuesten (paulmcq) Date: 2011-09-25 19:49 Message: Code in revision 900. ---------------------------------------------------------------------- Comment By: Paul McQuesten (paulmcq) Date: 2011-09-25 19:48 Message: Sun compiler rightly objected to assigning a size_t to an int. With default x86_64 memory model that is storing a uint64_t into an int32_t. OTHO, 2 billion spec entries is quite sufficient for this decade. Structure changed to uint32_t, and code changed to do explicit truncation. Could someone with a Solaris compiler please test this? ---------------------------------------------------------------------- Comment By: Paul McQuesten (paulmcq) Date: 2011-05-24 00:57 Message: Note that the patch proposed by davidmarker on 2010-10-04 is dangerous: it assumes that an 'int' is as big as a 'size_t', which is not true for the default x86_64 memory models on Linux where int is 4 bytes but size_t is 8. ---------------------------------------------------------------------- Comment By: Paul McQuesten (paulmcq) Date: 2011-01-09 21:52 Message: I do not have your compilers, so cannot really check, but I think the proposed patch just hides a symptom. I think the actual fix should be on line 495 of re.h. Change first member of NRegExp to size_t: from: typedef std::pair<int, RegExp*> NRegExp; to: typedef std::pair<size_t, RegExp*> NRegExp; The second member is okay as is, because RuleOp is a derived class of RegExp. ---------------------------------------------------------------------- Comment By: David Marker (davidmarker) Date: 2010-10-04 13:35 Message: Hit same issue, resolved it with this patch (but haven't tested yet, just got it to build): --- parser.cc-orig Mon Oct 4 14:22:39 2010 +++ parser.cc Mon Oct 4 14:21:17 2010 @@ -198,7 +198,8 @@ else { size_t nIndex = specMap.size() + 1; // 0 is reserved for "0"-spec - specMap[*it] = std::make_pair(nIndex, rule); + //specMap[*it] = std::make_pair(nIndex, rule); + specMap[*it] = std::make_pair((int)nIndex, static_cast<RegExp*>(rule)); } } ---------------------------------------------------------------------- Comment By: Thomas Wagner (tom68) Date: 2009-02-13 05:41 Message: it is the same with sparc and "Sun Ceres C 5.10 SunOS_sparc 2008/10/22" (SunStudioExpress): pkgbuild: /opt/SUNWspro/bin/CC -DHAVE_CONFIG_H -I. -g -c -o parser.o parser.cc pkgbuild: "parser.y", line 98: Warning (Anachronism): Assigning std::pair<unsigned, re2c::RuleOp*> to std::pair<int, re2c::RegExp*>. pkgbuild: "parser.y", line 98: Error: Cannot cast from std::pair<unsigned, re2c::RuleOp*> to std::pair<int, re2c::RegExp*>. pkgbuild: 1 Error(s) and 1 Warning(s) detected. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=616200&aid=2535084&group_id=96864 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Re2c-general mailing list Re2c-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/re2c-general