public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/98457] New: [d] writef!"%s" doesn't work with MonoTime / SysTick
@ 2020-12-27 23:56 witold.baryluk+gcc at gmail dot com
  2020-12-27 23:58 ` [Bug d/98457] " witold.baryluk+gcc at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: witold.baryluk+gcc at gmail dot com @ 2020-12-27 23:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98457

            Bug ID: 98457
           Summary: [d] writef!"%s" doesn't work with MonoTime / SysTick
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: witold.baryluk+gcc at gmail dot com
  Target Milestone: ---

void main() {
  import std.stdio;
  import core.time : MonoTime;
  writef!"%s"(MonoTime.currTime());
}


Doesn't compile with gdc 10.2.1:

$ gdc test_monotime.d 
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/core/time.d:2405:16: error: static
variable _ticksPerSecond cannot be read at compile time
 2405 |         return _ticksPerSecond[_clockIdx];
      |                ^
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/core/time.d:2418:99: note: called
from here: ticksPerSecond()
 2418 |             return "MonoTime(" ~ signedToTempString(_ticks, 10) ~ "
ticks, " ~ signedToTempString(ticksPerSecond, 10) ~ " ticks per second)";
      |                                                                        
                          ^
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/core/time.d:2418:98: note: called
from here: signedToTempString(ticksPerSecond(), 10u)
 2418 |             return "MonoTime(" ~ signedToTempString(_ticks, 10) ~ "
ticks, " ~ signedToTempString(ticksPerSecond, 10) ~ " ticks per second)";
      |                                                                        
                         ^
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/std/format.d:3353:28: note: called
from here: val.toString()
 3353 |         put(w, val.toString());
      |                            ^
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/std/format.d:3353:12: note: called
from here: put(w, val.toString())
 3353 |         put(w, val.toString());
      |            ^
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/std/format.d:3672:21: note: called
from here: formatObject(w, val, f)
 3672 |         formatObject(w, val, f);
      |                     ^
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/std/format.d:568:28: note: called
from here: formatValue(w, _param_2, spec)
  568 |                 formatValue(w, args[i], spec);
      |                            ^
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/std/format.d:5767:28: note: called
from here: formattedWrite(w, fmt, _param_1)
 5767 |     auto n = formattedWrite(w, fmt, args);
      |                            ^
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/std/format.d:5729:16: note: called
from here: format("%s", MonoTimeImpl(0L))
 5729 |         .format(fmt, Args.init);
      |                ^
/usr/lib/gcc/x86_64-linux-gnu/10/include/d/std/format.d:5733:2: note: called
from here: (*function () => null)()
 5733 | }();
      |  ^

(null):0: confused by earlier errors, bailing out



Adding manually .toString() makes it work (at the expense of possible extra
allocation).

No issues in ldc2 1.24.0 or dmd2 2.095.0-beta.1

It doesn't look like issue in phobos, but something deeper.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-19 20:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27 23:56 [Bug d/98457] New: [d] writef!"%s" doesn't work with MonoTime / SysTick witold.baryluk+gcc at gmail dot com
2020-12-27 23:58 ` [Bug d/98457] " witold.baryluk+gcc at gmail dot com
2021-04-19 15:29 ` ibuclaw at gdcproject dot org
2021-04-19 17:29 ` cvs-commit at gcc dot gnu.org
2021-04-19 20:42 ` cvs-commit at gcc dot gnu.org
2021-04-19 20:42 ` cvs-commit at gcc dot gnu.org
2021-04-19 20:49 ` ibuclaw at gdcproject dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).